
正文
vb.net字形设置 vbcombo代码改字体样式
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
vb.net 代码调整字体大小
看样要重新定义个Font对象vb.net字形设置,在构造函数中定义它vb.net字形设置的大小vb.net字形设置,
With Button1.Font
Button1.Font = New Font(.FontFamily, 34, .Style, .Unit) '参数都用原来字体参数,只有大小改成你需要vb.net字形设置的。
End With
相关问答
Q1: vb.net中如何将文本字体加粗
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged Dim b As FontStyle
If CheckBox1.Checked Then b = FontStyle.Bold Else b = FontStyle.Regular End If TextBox1.Font = New Font(TextBox1.Font.Name, TextBox1.Font.Size, t) End Sub
Q2: VB.NET文本框中的文本格式进行相应的设置
太晚了,想不出什么好方法了。
发上来看看吧。
首先建立一个TextBox,我这里名字为TextBox2
然后放一个groupbox,在里头放两个Checkbox,checkbox1为粗体,checkbox2为斜体。
代码:
Dim Bold As Boolean
Dim Italic As Boolean
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked Then
Bold = True
If Italic Then
TextBox2.Font = New Font(TextBox2.Font, FontStyle.Bold Or FontStyle.Italic)
Else
TextBox2.Font = New Font(TextBox2.Font, FontStyle.Bold)
End If
Else
Bold = False
If Italic Then
TextBox2.Font = New Font(TextBox2.Font, FontStyle.Italic)
Else
TextBox2.Font = New Font(TextBox2.Font, 0)
End If
End If
End Sub
Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
If CheckBox2.Checked Then
Italic = True
If Bold Then
TextBox2.Font = New Font(TextBox2.Font, FontStyle.Italic Or FontStyle.Bold)
Else
TextBox2.Font = New Font(TextBox2.Font, FontStyle.Italic)
End If
Else
Italic = False
If Bold Then
TextBox2.Font = New Font(TextBox2.Font, FontStyle.Bold)
Else
TextBox2.Font = New Font(TextBox2.Font, 0)
End If
End If
End Sub
可以等等别人回答,看看有没有更好的方法。
Q3: vb.net 字体设置
给点提示吧,已粗体为例(完全是我自己的方法,不知别人是怎么做的):
'先获取选择的字体信息(字体、大小、样式。。。)
Dim currentFont As System.Drawing.Font = RichTextBox1.SelectionFont
'在重新定义某种样式的时候,不丢失其他信息
RichTextBox1.SelectionFont = New Font(currentFont.FontFamily, currentFont.Size, FontStyle.Bold)
Q4: vb.net字体的粗体斜体同时显示怎么设置
该参数枚举值,采用位运算,那么可以用Or把两者连接起来即可;
New Font(CurrentFont.FontFamily, CurrentFont.Size, FontStyle.Bold Or FontStyle.Italic)
Q5: vb.net如何设置FORM的text字体
您好。修改FORM的Font属性就可以修改窗体和其中所有控件的字体。
Me.Font = New System.Drawing.Font("宋体", 10)
另外,FORM标题栏的TEXT字体和颜色是操作系统决定的,要想改变,只能调用系统的api函数,截获操作系统的消息来改变。
下面的网址有C#版本的重绘标题栏范例
软糖的回答满意吗,请及时采纳,谢谢。
关于vb.net字形设置和vbcombo代码改字体样式的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。





