📄 vb-
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form VB字体颜色框调用
Caption = "字体颜色框调用"
ClientHeight = 2595
ClientLeft = 120
ClientTop = 450
ClientWidth = 5055
LinkTopic = "Form1"
ScaleHeight = 2595
ScaleWidth = 5055
StartUpPosition = 3 '窗口缺省
Begin MSComDlg.CommonDialog CommonDialog1
Left = 240
Top = 2040
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton Command2
Caption = "颜色"
Height = 375
Left = 3360
TabIndex = 2
Top = 2040
Width = 975
End
Begin VB.CommandButton Command1
Caption = "字体"
Height = 375
Left = 2160
TabIndex = 1
Top = 2040
Width = 975
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1575
Left = 240
TabIndex = 0
Top = 240
Width = 4095
End
End
Attribute VB_Name = "VB字体颜色框调用"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click() '字体
CommonDialog1.CancelError = True ' 将 Cancel 设置成 True
On Error GoTo ErrHandler ' 出错 跳转
CommonDialog1.Flags = cdlCFBoth Or cdlCFEffects
' 设置 Flags 属性
CommonDialog1.ShowFont ' 显示“字体”对话框
Text1.FontName = CommonDialog1.FontName
Text1.ForeColor = CommonDialog1.Color
Text1.FontSize = CommonDialog1.FontSize
Text1.FontBold = CommonDialog1.FontBold
Text1.FontItalic = CommonDialog1.FontItalic
Text1.FontUnderline = CommonDialog1.FontUnderline
Text1.FontStrikethru = CommonDialog1.FontStrikethru
Text1.SetFocus ' 把光标拉回到发送文本框
Exit Sub
ErrHandler: ' 用户按了“取消”按钮。
Text1.SetFocus ' 把光标拉回到发送文本框
Exit Sub
End Sub
Private Sub Command2_Click() ' 颜色
CommonDialog1.CancelError = True ' 将 Cancel 设置成 True
On Error GoTo ErrHandler ' 出错 跳转
CommonDialog1.Flags = cdlCCRGBInit ' 设置 Flags 属性
CommonDialog1.ShowColor ' 显示“颜色”对话框
Text1.ForeColor = CommonDialog1.Color ' text1颜色
Text1.SetFocus ' 把光标拉回到发送文本框
Exit Sub
ErrHandler: ' 用户按了“取消”按钮。
Text1.SetFocus ' 把光标拉回到发送文本框
Exit Sub
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -