📄 form2.frm
字号:
Top = 1440
Width = 735
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Key:"
Height = 195
Index = 0
Left = 0
TabIndex = 7
Top = 960
Width = 315
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Text:"
Height = 195
Index = 1
Left = 0
TabIndex = 6
Top = 480
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Index:"
Height = 195
Index = 2
Left = 0
TabIndex = 5
Top = 120
Width = 435
End
End
Begin MSComDlg.CommonDialog dlgGetPicture
Left = 570
Top = 3555
_ExtentX = 847
_ExtentY = 847
_Version = 393216
DialogTitle = "Select Picture"
End
Begin ComctlLib.TabStrip TabStrip1
Height = 3375
Left = 120
TabIndex = 0
Top = 120
Width = 5775
_ExtentX = 10186
_ExtentY = 5953
_Version = 327682
BeginProperty Tabs {0713E432-850A-101B-AFC0-4210102A8DA7}
NumTabs = 2
BeginProperty Tab1 {0713F341-850A-101B-AFC0-4210102A8DA7}
Caption = "General"
Key = "General"
Object.Tag = ""
ImageVarType = 2
EndProperty
BeginProperty Tab2 {0713F341-850A-101B-AFC0-4210102A8DA7}
Caption = "Panels"
Key = "Panels"
Object.Tag = ""
ImageVarType = 2
EndProperty
EndProperty
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim intNoErrors As Integer
Dim ctlX As Control
Dim intCurPanel As Integer
Sub DisableControls()
txtIndex.Enabled = False
txtText.Enabled = False
txtKey.Enabled = False
cboAlignment.Enabled = False
cboPnlStyle.Enabled = False
cboBevel.Enabled = False
cboAutosize.Enabled = False
txtMinWidth.Enabled = False
chkPanelEnabled.Enabled = False
chkPanelVisible.Enabled = False
cmdBrowse.Enabled = False
cmdPrevPanel.Enabled = False
cmdNextPanel.Enabled = False
cmdNoPicture.Enabled = False
End Sub
Sub EnableControls()
txtIndex.Enabled = True
txtText.Enabled = True
txtKey.Enabled = True
cboAlignment.Enabled = True
cboPnlStyle.Enabled = True
cboBevel.Enabled = True
cboAutosize.Enabled = True
txtMinWidth.Enabled = True
chkPanelEnabled.Enabled = True
chkPanelVisible.Enabled = True
cmdBrowse.Enabled = True
cmdPrevPanel.Enabled = True
cmdNextPanel.Enabled = True
End Sub
Sub GetPanelProperties()
txtText = ctlX.Panels(intCurPanel).Text
txtKey = ctlX.Panels(intCurPanel).Key
cboAlignment.ListIndex = ctlX.Panels(intCurPanel).Alignment
cboPnlStyle.ListIndex = ctlX.Panels(intCurPanel).Style
cboBevel.ListIndex = ctlX.Panels(intCurPanel).Bevel
cboAutosize.ListIndex = ctlX.Panels(intCurPanel).AutoSize
txtMinWidth = ctlX.Panels(intCurPanel).MinWidth
lblActualWidth.Caption = ctlX.Panels(intCurPanel).Width
Set imgPanelPicture = ctlX.Panels(intCurPanel).Picture
If imgPanelPicture Then _
cmdNoPicture.Enabled = True Else _
cmdNoPicture.Enabled = False
If ctlX.Panels(intCurPanel).Enabled Then _
chkPanelEnabled = 1 Else chkPanelEnabled = 0
If ctlX.Panels(intCurPanel).Style > 0 And _
ctlX.Panels(intCurPanel).Style < 5 Then _
chkPanelEnabled.Enabled = False Else _
chkPanelEnabled.Enabled = True
If ctlX.Panels(intCurPanel).Visible Then _
chkPanelVisible = 1 Else chkPanelVisible = 0
End Sub
Sub GetProperties()
If ctlX.Enabled Then chkEnabled = 1 _
Else chkEnabled = 0
cboStyle.ListIndex = ctlX.Style
cboAlign.ListIndex = ctlX.Align
txtSimpleText = ctlX.SimpleText
txtTop = ctlX.Top
txtLeft = ctlX.Left
txtWidth = ctlX.Width
txtHeight = ctlX.Height
If ctlX.Panels.Count > 0 Then GetPanelProperties
End Sub
Sub InitializeForm()
Set ctlX = Form1.staSample
If ctlX.Panels.Count > 0 Then
intCurPanel = 1
EnableControls
cmdRemove.Enabled = True
Else
intCurPanel = 0
txtText = ""
txtKey = ""
txtMinWidth = ""
lblActualWidth = ""
End If
txtIndex.Text = intCurPanel
dlgGetPicture.Filter = _
"Bitmap and Icon files (*.bmp;*.ico)|*.bmp;*.ico|" & _
"Bitmap files (*.bmp)|*.bmp" & _
"Icon files (*.ico)|*.ico"
intNoErrors = True
End Sub
Sub SetPanelProperties()
On Error GoTo ErrorHandler
ctlX.Panels(intCurPanel).Text = txtText
ctlX.Panels(intCurPanel).Key = txtKey
ctlX.Panels(intCurPanel).Alignment = cboAlignment.ListIndex
ctlX.Panels(intCurPanel).Style = cboPnlStyle.ListIndex
ctlX.Panels(intCurPanel).Bevel = cboBevel.ListIndex
ctlX.Panels(intCurPanel).AutoSize = cboAutosize.ListIndex
ctlX.Panels(intCurPanel).MinWidth = CDbl(txtMinWidth.Text)
If imgPanelPicture Then _
Set ctlX.Panels(intCurPanel).Picture = _
imgPanelPicture.Picture Else _
Set ctlX.Panels(intCurPanel).Picture = LoadPicture()
If ctlX.Panels(intCurPanel).Style < sbrCaps Or _
ctlX.Panels(intCurPanel).Style > sbrScrl Then _
If chkPanelEnabled Then _
ctlX.Panels(intCurPanel).Enabled = True Else _
ctlX.Panels(intCurPanel).Enabled = False
If chkPanelVisible Then _
ctlX.Panels(intCurPanel).Visible = True Else _
ctlX.Panels(intCurPanel).Visible = False
intNoErrors = True
Exit Sub
ErrorHandler:
MsgBox "(" & Err.Number & ") " & _
Err.Description, , App.ProductName
intNoErrors = False
End Sub
Sub SetProperties()
On Error GoTo ErrorHandler
If chkEnabled Then ctlX.Enabled = True _
Else ctlX.Enabled = False
ctlX.Style = cboStyle.ListIndex
ctlX.Align = cboAlign.ListIndex
ctlX.SimpleText = txtSimpleText
If ctlX.Align = vbAlignNone Then
ctlX.Top = txtTop
ctlX.Left = txtLeft
ctlX.Width = txtWidth
End If
ctlX.Height = txtHeight
intNoErrors = True
If ctlX.Panels.Count > 0 Then SetPanelProperties
Exit Sub
ErrorHandler:
MsgBox "(" & Err.Number & ") " & _
Err.Description, , App.ProductName
intNoErrors = False
End Sub
Private Sub cboAlign_Click()
cmdApply.Enabled = True
End Sub
Private Sub cboAlignment_Click()
cmdApply.Enabled = True
End Sub
Private Sub cboAutosize_Click()
cmdApply.Enabled = True
End Sub
Private Sub cboBevel_Click()
cmdApply.Enabled = True
End Sub
Private Sub cboPnlStyle_Click()
cmdApply.Enabled = True
End Sub
Private Sub cboStyle_Click()
cmdApply.Enabled = True
End Sub
Private Sub chkEnabled_Click()
cmdApply.Enabled = True
End Sub
Private Sub chkPanelEnabled_Click()
cmdApply.Enabled = True
End Sub
Private Sub chkPanelVisible_Click()
cmdApply.Enabled = True
End Sub
Private Sub cmdApply_Click()
SetProperties
cmdApply.Enabled = False
End Sub
Private Sub cmdBrowse_Click()
On Error GoTo ErrorHandler
dlgGetPicture.ShowOpen
If Dir(dlgGetPicture.FileName, 0) <> "" Then
Set imgPanelPicture = LoadPicture(dlgGetPicture.FileName)
cmdNoPicture.Enabled = True
cmdApply.Enabled = True
End If
Exit Sub
ErrorHandler:
MsgBox "(" & Err.Number & ") " & _
Err.Description, , App.ProductName
End Sub
Private Sub cmdCancel_Click()
intNoErrors = True
Unload Form2
End Sub
Private Sub cmdInsert_Click()
Dim intApplyEnabled As Integer
intApplyEnabled = cmdApply.Enabled
If intCurPanel > 0 Then
SetPanelProperties
Else
EnableControls
cmdRemove.Enabled = True
End If
If intNoErrors Then
intCurPanel = intCurPanel + 1
txtIndex.Text = intCurPanel
ctlX.Panels.Add (intCurPanel)
End If
GetPanelProperties
cmdApply.Enabled = intApplyEnabled
End Sub
Private Sub cmdNextPanel_Click()
If intCurPanel + 1 <= ctlX.Panels.Count Then
SetPanelProperties
If intNoErrors Then
intCurPanel = intCurPanel + 1
txtIndex = intCurPanel
End If
GetPanelProperties
End If
End Sub
Private Sub cmdNoPicture_Click()
imgPanelPicture = LoadPicture()
cmdNoPicture.Enabled = False
End Sub
Private Sub cmdOK_Click()
SetProperties
Unload Form2
End Sub
Private Sub cmdPrevPanel_Click()
If intCurPanel - 1 >= 1 Then
SetPanelProperties
If intNoErrors Then
intCurPanel = intCurPanel - 1
txtIndex = intCurPanel
End If
GetPanelProperties
End If
End Sub
Private Sub cmdRemove_Click()
Dim intApplyEnabled As Integer
intApplyEnabled = cmdApply.Enabled
ctlX.Panels.Remove (intCurPanel)
If intCurPanel > ctlX.Panels.Count Then
intCurPanel = intCurPanel - 1
txtIndex.Text = intCurPanel
End If
If intCurPanel > 0 Then
GetPanelProperties
Else
DisableControls
imgPanelPicture = LoadPicture()
cmdRemove.Enabled = False
End If
cmdApply.Enabled = intApplyEnabled
End Sub
Private Sub Form_Load()
InitializeForm
GetProperties
cmdApply.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
If intNoErrors Then
Set Form2 = Nothing
Else
Cancel = True
End If
End Sub
Private Sub TabStrip1_Click()
If TabStrip1.SelectedItem.Index = 1 Then _
picGeneral.Visible = True Else _
picGeneral.Visible = False
If TabStrip1.SelectedItem.Index = 2 Then _
picPanels.Visible = True Else _
picPanels.Visible = False
End Sub
Private Sub txtHeight_Change()
cmdApply.Enabled = True
End Sub
Private Sub txtIndex_LostFocus()
Dim intPnlIndex As Integer
intPnlIndex = CInt(txtIndex.Text)
If intPnlIndex < 1 Or intPnlIndex > ctlX.Panels.Count Then
If intPnlIndex > ctlX.Panels.Count Then _
txtIndex.Text = ctlX.Panels.Count Else _
txtIndex.Text = 1
End If
If txtIndex.Text <> intCurPanel Then
SetPanelProperties
intCurPanel = txtIndex.Text
GetPanelProperties
End If
End Sub
Private Sub txtKey_Change()
cmdApply.Enabled = True
End Sub
Private Sub txtLeft_Change()
cmdApply.Enabled = True
End Sub
Private Sub txtMinWidth_Change()
cmdApply.Enabled = True
End Sub
Private Sub txtSimpleText_Change()
cmdApply.Enabled = True
End Sub
Private Sub txtText_Change()
cmdApply.Enabled = True
End Sub
Private Sub txtTop_Change()
cmdApply.Enabled = True
End Sub
Private Sub txtWidth_Change()
cmdApply.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -