编写应用程序,在文本框中输入汉字,要求完成的功能是:复选框内有“√”,则显示相应的格式,如果取消“√”,则取消相应的格式。
有一个VB编程问题请教一下
- 提问者网友:缘字诀
- 2021-04-25 20:37
- 五星知识达人网友:夜风逐马
- 2021-04-25 20:44
Private Sub Check1_Click()
If Check1.Value = 1 Then
Text1.FontName = "楷体_GB2312"
Else
Text1.FontName = "宋体"
End If
End Sub
Private Sub Check2_Click()
If Check2.Value = 1 Then
Text1.FontItalic = True
Else
Text1.FontItalic = False
End If
End Sub
Private Sub Check3_Click()
If Check3.Value = 1 Then
Text1.FontSize = 25
Else
Text1.FontSize = 9
End If
End Sub
Private Sub Check4_Click()
If Check4.Value = 1 Then
Text1.ForeColor = vbRed
Else
Text1.ForeColor = RGB(0, 0, 0)
End If
End Sub
- 1楼网友:廢物販賣機
- 2021-04-25 23:01
Dim a, b, c
Private Sub Check_Click(Index As Integer) Select Case Index Case 0 If Check(0).Value = 1 Then Text1.FontName = "楷体" Else Text1.FontName = c End If Case 1 Text1.FontItalic = Not Text1.FontItalic Case 2 If Check(2).Value = 1 Then Text1.FontSize = 35 Else Text1.FontSize = a End If Case 3 If Check(3).Value = 1 Then Text1.ForeColor = Red Else Text1.ForeColor = b End If End Select End Sub
Private Sub Form_Load() a = Text1.FontSize b = Text1.ForeColor c = Text1.FontName End Sub
- 2楼网友:旧脸谱
- 2021-04-25 21:48
- 3楼网友:千夜
- 2021-04-25 21:32
Dim a, b, c
Private Sub Check_Click(Index As Integer) Select Case Index Case 0 If Check(0).Value = 1 Then Text1.FontName = "楷体" Else Text1.FontName = c End If Case 1 Text1.FontItalic = Not Text1.FontItalic Case 2 If Check(2).Value = 1 Then Text1.FontSize = 25 Else Text1.FontSize = a End If Case 3 If Check(3).Value = 1 Then Text1.ForeColor = vbRed Else Text1.ForeColor = b End If End Select End Sub
Private Sub Form_Load() a = Text1.FontSize b = Text1.ForeColor c = Text1.FontName End Sub