发布网友
共1个回答
热心网友
If KeyAscii = 13 Then
lable1.FontSize = Combo2.Text
End If
是错的 标签的名字拼错啦 是 label1 而不是 lable1
意思是当 键盘敲击 回车( ascii 码是 13 ) 的时候 更改字体,这是在你手动输入的时候回车生效设置
你的主要问题我没弄明白 你的代码应该可以改变字体和大小啦
如果你需要LABEL1 显示字体的名称和 字号的数值 你可以
Private Sub Form_Load()
For i = 0 To Screen.FontCount - 1
Combo1.AddItem Screen.Fonts(i)
Next i
For i = 6 To 40 Step 2
Combo2.AddItem i
Next i
End Sub
Private Sub Combo2_Keypress(KeyAscii As Integer)
If KeyAscii = 13 Then
Label1.FontSize = Combo2.Text
Label1.Caption = " 字体:" & Label1.FontName & " 大小:" & Label1.FontSize
End If
End Sub
Private Sub Combo1_Click()
Label1.FontName = Combo1.Text
Label1.Caption = " 字体:" & Label1.FontName & " 大小:" & Label1.FontSize
End Sub
Private Sub Combo2_Click()
Label1.FontSize = Combo2.Text
Label1.Caption = " 字体:" & Label1.FontName & " 大小:" & Label1.FontSize
End Sub