⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form2.frm

📁 这里有很多很实用的VB编程案例,方便大家学习VB.
💻 FRM
字号:
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Begin VB.Form Form2 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Slider控件属性"
   ClientHeight    =   4080
   ClientLeft      =   1875
   ClientTop       =   2715
   ClientWidth     =   6030
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   4080
   ScaleWidth      =   6030
   ShowInTaskbar   =   0   'False
   Begin VB.PictureBox picGeneral 
      Appearance      =   0  'Flat
      BackColor       =   &H00C0C0C0&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   2895
      Left            =   240
      ScaleHeight     =   2895
      ScaleWidth      =   5535
      TabIndex        =   11
      Top             =   480
      Width           =   5535
      Begin VB.CheckBox chkEnabled 
         Alignment       =   1  'Right Justify
         Caption         =   "Enabled"
         Height          =   255
         Left            =   2160
         TabIndex        =   23
         Top             =   0
         Width           =   1575
      End
      Begin VB.TextBox txtMax 
         Height          =   375
         Left            =   1320
         TabIndex        =   22
         Text            =   "txtMax"
         Top             =   360
         Width           =   975
      End
      Begin VB.TextBox txtMin 
         Height          =   375
         Left            =   4080
         TabIndex        =   21
         Text            =   "txtMin"
         Top             =   360
         Width           =   975
      End
      Begin VB.TextBox txtSmallChange 
         Height          =   375
         Left            =   1320
         TabIndex        =   20
         Text            =   "txtSmallChange"
         Top             =   840
         Width           =   975
      End
      Begin VB.TextBox txtLargeChange 
         Height          =   375
         Left            =   4080
         TabIndex        =   19
         Text            =   "txtLargeChange"
         Top             =   840
         Width           =   975
      End
      Begin VB.Frame Frame1 
         Caption         =   "Range Selection"
         Height          =   1335
         Left            =   0
         TabIndex        =   12
         Top             =   1440
         Width           =   5535
         Begin VB.CheckBox chkSelRange 
            Alignment       =   1  'Right Justify
            Caption         =   "Enable Select Range"
            Height          =   195
            Left            =   1560
            TabIndex        =   13
            Top             =   240
            Width           =   2895
         End
         Begin VB.Label lblHint 
            AutoSize        =   -1  'True
            BorderStyle     =   1  'Fixed Single
            Caption         =   "To select a range, hold SHIFT and drag the Slider pointer."
            Height          =   255
            Left            =   720
            TabIndex        =   18
            Top             =   600
            Visible         =   0   'False
            Width           =   4155
         End
         Begin VB.Label lblSelLength 
            AutoSize        =   -1  'True
            Caption         =   "lblSelLength"
            Height          =   195
            Left            =   4200
            TabIndex        =   17
            Top             =   960
            Width           =   870
         End
         Begin VB.Label lblSelStart 
            AutoSize        =   -1  'True
            Caption         =   "lblSelStart"
            Height          =   195
            Left            =   1440
            TabIndex        =   16
            Top             =   960
            Width           =   705
         End
         Begin VB.Label Label 
            AutoSize        =   -1  'True
            Caption         =   "Selection Start"
            Height          =   195
            Index           =   4
            Left            =   120
            TabIndex        =   15
            Top             =   960
            Width           =   1035
         End
         Begin VB.Label Label 
            AutoSize        =   -1  'True
            Caption         =   "Selection Length"
            Height          =   195
            Index           =   5
            Left            =   2760
            TabIndex        =   14
            Top             =   960
            Width           =   1200
         End
      End
      Begin VB.Label Label 
         AutoSize        =   -1  'True
         Caption         =   "Min."
         Height          =   195
         Index           =   0
         Left            =   2880
         TabIndex        =   27
         Top             =   360
         Width           =   300
      End
      Begin VB.Label Label 
         AutoSize        =   -1  'True
         Caption         =   "Max."
         Height          =   195
         Index           =   1
         Left            =   120
         TabIndex        =   26
         Top             =   360
         Width           =   345
      End
      Begin VB.Label Label 
         AutoSize        =   -1  'True
         Caption         =   "SmallChange"
         Height          =   195
         Index           =   3
         Left            =   120
         TabIndex        =   25
         Top             =   840
         Width           =   930
      End
      Begin VB.Label Label 
         AutoSize        =   -1  'True
         Caption         =   "LargeChange"
         Height          =   195
         Index           =   2
         Left            =   2880
         TabIndex        =   24
         Top             =   840
         Width           =   960
      End
   End
   Begin VB.CommandButton cmdApply 
      Caption         =   "Apply"
      Enabled         =   0   'False
      Height          =   375
      Left            =   4680
      TabIndex        =   5
      Top             =   3600
      Width           =   1215
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "Cancel"
      Height          =   375
      Left            =   3360
      TabIndex        =   4
      Top             =   3600
      Width           =   1215
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "OK"
      Height          =   375
      Left            =   2040
      TabIndex        =   3
      Top             =   3600
      Width           =   1215
   End
   Begin VB.PictureBox picAppearance 
      Appearance      =   0  'Flat
      BackColor       =   &H00C0C0C0&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   2895
      Left            =   240
      ScaleHeight     =   2895
      ScaleWidth      =   5535
      TabIndex        =   7
      Top             =   480
      Width           =   5535
      Begin VB.TextBox txtTickFrequency 
         Height          =   285
         Left            =   1800
         TabIndex        =   2
         Text            =   "txtFrequency"
         Top             =   1080
         Width           =   2175
      End
      Begin VB.ComboBox cboTickStyle 
         Height          =   300
         ItemData        =   "form2.frx":0000
         Left            =   1800
         List            =   "form2.frx":0010
         Style           =   2  'Dropdown List
         TabIndex        =   1
         Top             =   600
         Width           =   2175
      End
      Begin VB.ComboBox cboOrientation 
         Height          =   300
         ItemData        =   "form2.frx":0048
         Left            =   1800
         List            =   "form2.frx":0052
         Style           =   2  'Dropdown List
         TabIndex        =   0
         Top             =   120
         Width           =   2175
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "TickFrequency:"
         Height          =   195
         Index           =   0
         Left            =   0
         TabIndex        =   10
         Top             =   1080
         Width           =   1110
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "TickStyle:"
         Height          =   195
         Index           =   1
         Left            =   0
         TabIndex        =   9
         Top             =   600
         Width           =   705
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "Orientation:"
         Height          =   195
         Index           =   2
         Left            =   0
         TabIndex        =   8
         Top             =   120
         Width           =   810
      End
   End
   Begin ComctlLib.TabStrip TabStrip1 
      Height          =   3375
      Left            =   120
      TabIndex        =   6
      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         =   "Appearance"
            Key             =   "Appearance"
            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 intOkClose As Integer

Sub GetProperties()
    Dim objX As Control
    Set objX = Form1.sldTestSlider
    If objX.Enabled Then chkEnabled = 1 _
        Else chkEnabled = 0
    txtMax = objX.Max
    txtMin = objX.Min
    txtSmallChange = objX.SmallChange
    txtLargeChange = objX.LargeChange
    If objX.SelectRange Then chkSelRange = 1 _
        Else chkSelRange = 0
    lblSelStart = objX.SelStart
    lblSelLength = objX.SelLength
    cboOrientation.ListIndex = objX.Orientation
    cboTickStyle.ListIndex = objX.TickStyle
    txtTickFrequency = objX.TickFrequency
    
End Sub


Sub SetProperties()
    Dim objX As Control
    On Error GoTo ErrorHandler
    Set objX = Form1.sldTestSlider
    If chkEnabled Then objX.Enabled = True _
        Else objX.Enabled = False
    objX.Max = txtMax
    objX.Min = txtMin
    objX.SmallChange = txtSmallChange
    objX.LargeChange = txtLargeChange
    objX.SelectRange = chkSelRange
    objX.Orientation = cboOrientation.ListIndex
    objX.TickStyle = cboTickStyle.ListIndex
    objX.TickFrequency = txtTickFrequency

    cmdApply.Enabled = False
    intOkClose = True
    Form1.SetFocus
    Exit Sub
    
ErrorHandler:
    Select Case Err.Number
        Case Is = 13
            MsgBox "Property must be an integer", , App.ProductName
        Case Is = 6
            MsgBox "Property value too large", , App.ProductName
        Case Is = 380
            MsgBox "Invalid property value", , App.ProductName
        
    End Select
    intOkClose = False
    
End Sub


Private Sub cboOrientation_Click()
    cmdApply.Enabled = True
End Sub


Private Sub cboTickStyle_Click()
    cmdApply.Enabled = True
End Sub


Private Sub chkEnabled_Click()
    cmdApply.Enabled = True
End Sub

Private Sub chkSelRange_Click()
    
    cmdApply.Enabled = True
    If chkSelRange Then
        lblHint.Visible = True
    Else
        lblHint.Visible = False
    End If
End Sub

Private Sub cmdApply_Click()
    SetProperties
End Sub

Private Sub cmdCancel_Click()
    intOkClose = True
    Unload Form2
End Sub


Private Sub cmdOK_Click()
    SetProperties
    Unload Form2
End Sub

Private Sub Form_Load()
    GetProperties
    cmdApply.Enabled = False
    intOkClose = True
End Sub

Private Sub Form_Unload(Cancel As Integer)
    If intOkClose 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 _
    picAppearance.Visible = True Else _
    picAppearance.Visible = False
End Sub


Private Sub txtLargeChange_Change()
    cmdApply.Enabled = True
End Sub

Private Sub txtMax_Change()
    cmdApply.Enabled = True
End Sub


Private Sub txtMin_Change()
    cmdApply.Enabled = True
End Sub



Private Sub txtSmallChange_Change()
    cmdApply.Enabled = True
End Sub


Private Sub txtTickFrequency_Change()
    cmdApply.Enabled = True
End Sub


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -