pexam10_6.frm
来自「深圳大学的vb上机与教学的课件」· FRM 代码 · 共 301 行
FRM
301 行
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form form1
Caption = "设计菜单示例"
ClientHeight = 1965
ClientLeft = 5940
ClientTop = 4590
ClientWidth = 3360
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 1965
ScaleWidth = 3360
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 495
Left = 0
TabIndex = 1
Top = 1470
Width = 3360
_ExtentX = 5927
_ExtentY = 873
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 3
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 1764
MinWidth = 1764
Picture = "pexam10_6.frx":0000
Text = "编辑"
TextSave = "编辑"
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Style = 1
Enabled = 0 'False
Object.Width = 1235
MinWidth = 1235
TextSave = "CAPS"
EndProperty
BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Style = 5
Picture = "pexam10_6.frx":0452
TextSave = "9:42"
EndProperty
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
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 = 1335
Left = 120
MultiLine = -1 'True
TabIndex = 0
Text = "pexam10_6.frx":0BA4
Top = 120
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 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
StatusBar1.Panels(1).Text = "锁定"
StatusBar1.Panels(1).Picture = LoadPicture("C:\Program Files\Microsoft Visual Studio\Common\Graphics\Icons\Misc\SECUR02B.ico")
Else
EE3.Caption = "锁定"
Text1.Locked = False
StatusBar1.Panels(1).Text = "编辑"
StatusBar1.Panels(1).Picture = LoadPicture("C:\Program Files\Microsoft Visual Studio\Common\Graphics\Icons\Writing\note14.ico")
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 + =
减小字号Ctrl + -
显示快捷键?