VB.net中如何在代码中设置文本框字体的大小

添加了一个Textbox1文本框、一个RadioButton单选按钮。现在需要选中单选按钮后,文本框中的字体变成10号字体。如何用代码实现?

第1个回答  2011-03-30
Private Sub RadioButton1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
Dim a As FontStyle
a = Me.TextBox1.Font.Size
Dim b As Single = a * 10
Me.TextBox1.Width = Me.TextBox1.Width * 10
Me.TextBox1.Font = New System.Drawing.Font("PMingLiU ", b, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(136, Byte)) '放大10倍,若仅10号字体,则将b改为10
End Sub本回答被网友采纳
第2个回答  2011-03-25
选准文本框,然后找:属性-字体。

希望对你有帮助追问

你说的是通过属性窗口来实现的,我想在程序运行时用代码实现,就相当于一个简单的记事本,用单选按钮可以改变字体的大小。

第3个回答  2011-03-25
k(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Location = New Point(10, 10) '位置
TextBox1.Size = New Point(500, 600) '大小
End Sub追问

不是文本框的大小,是其中字体的大小,用代码实现

第4个回答  2011-03-24
工具---设置--字体