用VS2008写VB程序时Fontsize”不是“System.Windows.Forms.TextBox”的成员

用VS2008写VB程序用FontSize时为什么会提示“Fontsize”不是“System.Windows.Forms.TextBox”的成员... 用VS2008写VB程序用FontSize时为什么会提示 “Fontsize”不是“System.Windows.Forms.TextBox”的成员 展开
 我来答
窥窥爱絮色325
2014-06-17 · 超过59用户采纳过TA的回答
知道答主
回答量:109
采纳率:0%
帮助的人:137万
展开全部
因为System.Windows.Forms.TextBox确实没有Fontsize这个成员,只有Font成员,如果你想在运行时改变字体大小的话,参考MSDN例子: Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged ' Cast the sender object back to a ComboBox. Dim ComboBox1 As ComboBox = CType(sender, ComboBox) ' Retrieve the selected item. Dim selectedString As String = CType(ComboBox1.SelectedItem, String) ' Convert it to lowercase. selectedString = selectedString.ToLower() ' Declare the current size. Dim currentSize As Single ' Switch on the selected item. Select Case selectedString ' If Bigger is selected, get the current size from the ' Size property and increase it. Reset the font to the ' new size, using the current unit. Case "bigger" currentSize = Label1.Font.Size currentSize += 2.0F Label1.Font = New Font(Label1.Font.Name, currentSize, _ Label1.Font.Style, Label1.Font.Unit) ' If Smaller is selected, get the current size, in points, ' and decrease it by 1. Reset the font with the new size ' in points. Case "smaller" currentSize = Label1.Font.SizeInPoints currentSize -= 1 Label1.Font = New Font(Label1.Font.Name, currentSize, _ Label1.Font.Style) End Select End Sub
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式