【VB开源代码栏目提醒】:网学会员鉴于大家对VB开源代码十分关注,论文会员在此为大家搜集整理了“frmFont.frm”一文,供大家参考学习
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmFont
Caption = "Form1"
ClientHeight = 2820
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 2820
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin MSComDlg.CommonDialog CommonDialog1
Left = 240
Top = 2280
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton Command1
Caption = "设置字体"
Height = 375
Left = 2640
TabIndex = 1
Top = 2280
Width = 1455
End
Begin VB.TextBox Text1
Height = 1935
Left = 120
TabIndex = 0
Text = "Text1"
Top = 120
Width = 4455
End
End
Attribute
VB_Name = "frmFont"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
' 设置“取消”为 True
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
' 设置 Flags 属性
CommonDialog1.Flags = cdlCFEffects Or cdlCFBoth
' 显示“字体”对话框
CommonDialog1.ShowFont
Text1.Font.Name = CommonDialog1.FontName
Text1.Font.Size = CommonDialog1.FontSize
Text1.Font.Bold = CommonDialog1.FontBold
Text1.Font.Italic = CommonDialog1.FontItalic
Text1.Font.Underline = CommonDialog1.FontUnderline
Text1.FontStrikethru = CommonDialog1.FontStrikethru
Text1.ForeColor = CommonDialog1.Color
Exit Sub
ErrHandler:
' 用户按了“取消”按钮
Exit Sub
End Sub