📄 dlglabel.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{0B81E4A9-BE4E-4AEF-9272-33AB5B51C6FC}#1.0#0"; "XPControls.ocx"
Begin VB.Form dlgLabel
BackColor = &H80000018&
BorderStyle = 3 'Fixed Dialog
Caption = "修改标签"
ClientHeight = 2415
ClientLeft = 2760
ClientTop = 3750
ClientWidth = 4950
Icon = "dlgLabel.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2415
ScaleWidth = 4950
ShowInTaskbar = 0 'False
Begin MSComDlg.CommonDialog CommonDialog1
Left = 4260
Top = 1620
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin XPControls.XPCommandButton cmdFont
Height = 315
Left = 4170
TabIndex = 1
Top = 360
Width = 615
_ExtentX = 1085
_ExtentY = 556
Caption = "字体..."
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.TextBox txtLabel
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1275
Left = 1080
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Top = 360
Width = 3015
End
Begin XPControls.XPCommandButton cmdCancel
Height = 375
Left = 2790
TabIndex = 3
Top = 1830
Width = 975
_ExtentX = 1720
_ExtentY = 661
Caption = "取消(&C)"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin XPControls.XPCommandButton cmdOK
Height = 375
Left = 1230
TabIndex = 2
Top = 1830
Width = 975
_ExtentX = 1720
_ExtentY = 661
Caption = "确定(&O)"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "标签文本:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 150
TabIndex = 4
Top = 390
Width = 915
End
End
Attribute VB_Name = "dlgLabel"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mstrLabel As String
Dim mtypFont As FontType
Public Function ShowLabel(ByVal strLabel As String, ByRef objControl As Object) As String
With txtLabel
.Text = strLabel
.FontName = objControl.FontName
.FontSize = objControl.FontSize
.FontBold = objControl.FontBold
.FontItalic = objControl.FontItalic
.FontUnderline = objControl.FontUnderline
End With
Me.Show vbModal
If mstrLabel <> "" Then
With objControl
.FontName = mtypFont.FontName
.FontSize = mtypFont.FontSize
.FontBold = mtypFont.FontBold
.FontItalic = mtypFont.FontItalic
.FontUnderline = mtypFont.FontUnderline
.Alignment = mtypFont.Alignment
End With
ShowLabel = mstrLabel
End If
End Function
Private Sub cmdCancel_Click()
mstrLabel = ""
Unload Me
End Sub
Private Sub cmdFont_Click()
On Error Resume Next
With CommonDialog1
.DialogTitle = "字体设置"
.CancelError = True
.Flags = cdlCFBoth
.FontName = txtLabel.FontName
.FontSize = txtLabel.FontSize
.FontBold = txtLabel.FontBold
.FontItalic = txtLabel.FontItalic
.FontUnderline = txtLabel.FontUnderline
.ShowFont
If Err.Number = 0 Then
txtLabel.FontName = .FontName
txtLabel.FontSize = .FontSize
txtLabel.FontBold = .FontBold
txtLabel.FontItalic = .FontItalic
txtLabel.FontUnderline = .FontUnderline
End If
End With
End Sub
Private Sub cmdOK_Click()
If txtLabel.Text = "" Then
MsgBox "请输入标签文本!", vbInformation, "提示"
txtLabel.SetFocus
Exit Sub
End If
mstrLabel = txtLabel.Text
With mtypFont
.FontName = txtLabel.FontName
.FontSize = txtLabel.FontSize
.FontBold = txtLabel.FontBold
.FontItalic = txtLabel.FontItalic
.FontUnderline = txtLabel.FontUnderline
.Alignment = txtLabel.Alignment
End With
Unload Me
End Sub
Private Sub txtLabel_LostFocus()
txtLabel.Text = Trim(txtLabel.Text)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -