📄 pexam10_4.frm
字号:
VERSION 5.00
Begin VB.Form form1
Caption = "用手工方式制作工具栏"
ClientHeight = 2145
ClientLeft = 5940
ClientTop = 4590
ClientWidth = 3765
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 2145
ScaleWidth = 3765
StartUpPosition = 2 '屏幕中心
Begin VB.PictureBox Picture1
Align = 1 'Align Top
Height = 490
Left = 0
ScaleHeight = 435
ScaleWidth = 3705
TabIndex = 1
Top = 0
Width = 3765
Begin VB.CheckBox Check4
Height = 490
Left = 1440
Picture = "pexam10_4.frx":0000
Style = 1 'Graphical
TabIndex = 5
ToolTipText = "斜体"
Top = 0
Width = 495
End
Begin VB.CheckBox Check3
Height = 490
Left = 960
Picture = "pexam10_4.frx":0F72
Style = 1 'Graphical
TabIndex = 4
ToolTipText = "粗体"
Top = 0
Width = 495
End
Begin VB.CheckBox Check2
Height = 490
Left = 480
Picture = "pexam10_4.frx":1EE4
Style = 1 'Graphical
TabIndex = 3
ToolTipText = "下划线"
Top = 0
Width = 495
End
Begin VB.CheckBox Check1
Height = 490
Left = 0
Picture = "pexam10_4.frx":2E56
Style = 1 'Graphical
TabIndex = 2
ToolTipText = "删除线"
Top = 0
Width = 495
End
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1215
Left = 240
MultiLine = -1 'True
TabIndex = 0
Text = "pexam10_4.frx":3DC8
Top = 720
Width = 3135
End
Begin VB.Menu AA
Caption = "字体(&F)"
Begin VB.Menu AA1
Caption = "宋体"
Index = 1
Shortcut = ^A
End
Begin VB.Menu AA1
Caption = "黑体"
Index = 2
Shortcut = ^B
End
Begin VB.Menu AA1
Caption = "-"
Index = 3
End
Begin VB.Menu AA1
Caption = "隶书"
Index = 4
Shortcut = ^C
End
Begin VB.Menu AA1
Caption = "楷体_GB2312"
Index = 5
Shortcut = ^D
End
End
Begin VB.Menu BB
Caption = "字号(&S)"
Begin VB.Menu BB1
Caption = "14"
Index = 1
End
Begin VB.Menu BB1
Caption = "16"
Index = 2
End
Begin VB.Menu BB1
Caption = "18"
Index = 3
End
Begin VB.Menu BB1
Caption = "20"
Index = 4
End
End
Begin VB.Menu CC
Caption = "颜色(&C)"
Begin VB.Menu CC1
Caption = "红色"
End
Begin VB.Menu CC2
Caption = "绿色"
End
Begin VB.Menu CC3
Caption = "蓝色"
End
End
Begin VB.Menu DD
Caption = "效果(&E)"
Begin VB.Menu DD1
Caption = "删除线"
End
Begin VB.Menu DD2
Caption = "下划线"
End
Begin VB.Menu DD3
Caption = "粗体"
End
Begin VB.Menu DD4
Caption = "斜体"
End
End
Begin VB.Menu EE
Caption = "文本框快捷菜单"
Visible = 0 'False
Begin VB.Menu EE1
Caption = "增加1磅"
End
Begin VB.Menu EE2
Caption = "减少1磅"
End
Begin VB.Menu EE3
Caption = "锁定"
End
End
Begin VB.Menu FF
Caption = "窗体快捷菜单"
Visible = 0 'False
Begin VB.Menu FF1
Caption = "红色背景"
End
Begin VB.Menu FF2
Caption = "绿色背景"
End
Begin VB.Menu FF3
Caption = "默认背景"
End
End
End
Attribute VB_Name = "form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Fcolor As Long
Private Sub AA1_Click(Index As Integer)
Text1.Font = AA1(Index).Caption
End Sub
Private Sub BB1_Click(Index As Integer)
Text1.FontSize = Val(BB1(Index).Caption)
End Sub
Private Sub CC1_Click()
Text1.ForeColor = vbRed
End Sub
Private Sub CC2_Click()
Text1.ForeColor = vbGreen
End Sub
Private Sub CC3_Click()
Text1.ForeColor = vbBlue
End Sub
Private Sub Command1_Click()
a = Val(InputBox("请输入字体"))
End Sub
Private Sub Check1_Click()
Text1.FontStrikethru = Check1.Value
End Sub
Private Sub Check2_Click()
Text1.FontUnderline = Check2.Value
End Sub
Private Sub Check3_Click()
Text1.FontBold = Check3.Value
End Sub
Private Sub Check4_Click()
Text1.FontItalic = Check4.Value
End Sub
Private Sub DD1_Click()
If DD1.Checked = True Then
Text1.FontStrikethru = False
DD1.Checked = False
Else
Text1.FontStrikethru = True
DD1.Checked = True
End If
End Sub
Private Sub DD2_Click()
If DD2.Checked = True Then
Text1.FontUnderline = False
DD2.Checked = False
Else
Text1.FontUnderline = True
DD2.Checked = True
End If
End Sub
Private Sub DD3_Click()
If DD3.Checked = True Then
Text1.FontBold = False
DD3.Checked = False
Else
Text1.FontBold = True
DD3.Checked = True
End If
End Sub
Private Sub DD4_Click()
If DD4.Checked = True Then
Text1.FontItalic = False
DD4.Checked = False
Else
Text1.FontItalic = True
DD4.Checked = True
End If
End Sub
Private Sub EE1_Click()
Text1.FontSize = Text1.FontSize + 1
End Sub
Private Sub EE2_Click()
Text1.FontSize = Text1.FontSize - 1
End Sub
Private Sub EE3_Click()
If EE3.Caption = "锁定" Then
EE3.Caption = "取消锁定"
Text1.Locked = True
Else
EE3.Caption = "锁定"
Text1.Locked = False
End If
End Sub
Private Sub FF1_Click()
form1.BackColor = vbRed
End Sub
Private Sub FF2_Click()
form1.BackColor = vbGreen
End Sub
Private Sub FF3_Click()
form1.BackColor = Fcolor '&H8000000F
End Sub
Private Sub Form_Load()
Fcolor = form1.BackColor
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
PopupMenu FF, 8 Or 0, , , FF3
End If
End Sub
Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
PopupMenu EE, 0 Or 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -