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

📄 frmsetpreferences.frm

📁 个人VB学习源码精选,自己学习时的一些编程小程序,希望对大家有帮助
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmSetPreferences 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "DataBound Grid Preferences"
   ClientHeight    =   4185
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6210
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4185
   ScaleWidth      =   6210
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  '窗口缺省
   Begin VB.ComboBox PropertyList 
      Height          =   300
      Index           =   5
      Left            =   2790
      TabIndex        =   13
      Text            =   "Combo1"
      Top             =   3735
      Width           =   3120
   End
   Begin VB.ComboBox PropertyList 
      Height          =   300
      Index           =   4
      Left            =   4005
      TabIndex        =   12
      Text            =   "Combo1"
      Top             =   2925
      Width           =   1950
   End
   Begin VB.ComboBox PropertyList 
      Height          =   300
      Index           =   3
      Left            =   2790
      TabIndex        =   11
      Text            =   "Combo1"
      Top             =   2925
      Width           =   1095
   End
   Begin VB.ComboBox PropertyList 
      Height          =   300
      Index           =   2
      Left            =   2790
      TabIndex        =   10
      Text            =   "Combo1"
      Top             =   2070
      Width           =   3165
   End
   Begin VB.ComboBox PropertyList 
      Height          =   300
      Index           =   1
      Left            =   2790
      TabIndex        =   9
      Text            =   "Combo1"
      Top             =   1215
      Width           =   3210
   End
   Begin VB.ComboBox PropertyList 
      Height          =   300
      Index           =   0
      Left            =   2790
      TabIndex        =   8
      Text            =   "Combo1"
      Top             =   360
      Width           =   3210
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "E&xit"
      Height          =   465
      Left            =   315
      TabIndex        =   7
      Top             =   3555
      Width           =   1770
   End
   Begin VB.PictureBox Picture1 
      Height          =   3165
      Left            =   45
      ScaleHeight     =   3105
      ScaleWidth      =   2430
      TabIndex        =   0
      Top             =   135
      Width           =   2490
      Begin VB.CheckBox chkDBOps 
         Caption         =   "AllowRowResi&zing"
         Height          =   285
         Index           =   5
         Left            =   315
         TabIndex        =   6
         Top             =   2610
         Width           =   1860
      End
      Begin VB.CheckBox chkDBOps 
         Caption         =   "Record&Selectors"
         Height          =   285
         Index           =   4
         Left            =   315
         TabIndex        =   5
         Top             =   2115
         Width           =   1680
      End
      Begin VB.CheckBox chkDBOps 
         Caption         =   "Column&Headers"
         Height          =   285
         Index           =   3
         Left            =   315
         TabIndex        =   4
         Top             =   1620
         Width           =   1680
      End
      Begin VB.CheckBox chkDBOps 
         Caption         =   "Allow&Update"
         Height          =   285
         Index           =   2
         Left            =   315
         TabIndex        =   3
         Top             =   1125
         Width           =   1680
      End
      Begin VB.CheckBox chkDBOps 
         Caption         =   "Allow&Delete"
         Height          =   285
         Index           =   1
         Left            =   315
         TabIndex        =   2
         Top             =   630
         Width           =   1680
      End
      Begin VB.CheckBox chkDBOps 
         Caption         =   "Allow&AddNew"
         Height          =   285
         Index           =   0
         Left            =   315
         TabIndex        =   1
         Top             =   135
         Width           =   1680
      End
   End
   Begin VB.Label Label6 
      Caption         =   "Alignment"
      Height          =   240
      Left            =   2790
      TabIndex        =   19
      Top             =   3420
      Width           =   1545
   End
   Begin VB.Label Label5 
      Caption         =   "Column Seperator"
      Height          =   240
      Left            =   4005
      TabIndex        =   18
      Top             =   2700
      Width           =   1590
   End
   Begin VB.Label Label4 
      Caption         =   "Column"
      Height          =   195
      Left            =   2790
      TabIndex        =   17
      Top             =   2700
      Width           =   870
   End
   Begin VB.Label Label3 
      Caption         =   "Border Styles"
      Height          =   195
      Left            =   2790
      TabIndex        =   16
      Top             =   1845
      Width           =   1950
   End
   Begin VB.Label Label2 
      Caption         =   "ScrollBar Styles"
      Height          =   195
      Left            =   2790
      TabIndex        =   15
      Top             =   990
      Width           =   1815
   End
   Begin VB.Label Label1 
      Caption         =   "Row Seperators"
      Height          =   195
      Left            =   2790
      TabIndex        =   14
      Top             =   135
      Width           =   1725
   End
End
Attribute VB_Name = "frmSetPreferences"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Enum DataBaseOps
    eAllowAddNew = 0
    eAllowDelete = 1
    eAllowUpdate = 2
    eColumnHeaders = 3
    eRecordSelectors = 4
    eAllowRowsizing = 5
End Enum
Private Enum GridProperties
    eRowDivider = 0
    eScrollBar = 1
    eBorderStyle = 2
    eColumnDivider = 3
    eColumns = 4
    eColumnAlignment = 5
End Enum
Private bLoading As Boolean
Public Sub GetExistingProperties()
    chkDBOps(eAllowAddNew).Value = IIf(frmMain.MainGrid.AllowAddNew, 1, 0)
    chkDBOps(eAllowDelete).Value = IIf(frmMain.MainGrid.AllowDelete, 1, 0)
    chkDBOps(eAllowUpdate).Value = IIf(frmMain.MainGrid.AllowUpdate, 1, 0)
    chkDBOps(eColumnHeaders).Value = IIf(frmMain.MainGrid.ColumnHeaders, 1, 0)
    chkDBOps(eRecordSelectors).Value = IIf(frmMain.MainGrid.RecordSelectors, 1, 0)
    chkDBOps(eAllowRowsizing).Value = IIf(frmMain.MainGrid.AllowRowSizing, 1, 0)
End Sub
Private Sub LoadCombos()
    PropertyList(eRowDivider).AddItem "No Lines"
    PropertyList(eRowDivider).AddItem "Black Line"
    PropertyList(eRowDivider).AddItem "Dark Gray Line"
    PropertyList(eRowDivider).AddItem "Raised Lines"
    PropertyList(eRowDivider).AddItem "Inset Lines"
    PropertyList(eRowDivider).AddItem "ForeColor"
    PropertyList(eRowDivider).ListIndex = frmMain.MainGrid.RowDividerStyle
    
    PropertyList(eScrollBar).AddItem "None"
    PropertyList(eScrollBar).AddItem "Horizontal"
    PropertyList(eScrollBar).AddItem "Vertical"
    PropertyList(eScrollBar).AddItem "Both"
    PropertyList(eScrollBar).AddItem "Automatic"
    PropertyList(eScrollBar).ListIndex = frmMain.MainGrid.ScrollBars
    
    PropertyList(eBorderStyle).AddItem "None"
    PropertyList(eBorderStyle).AddItem "Fixed Single"
    PropertyList(eBorderStyle).ListIndex = frmMain.MainGrid.BorderStyle
    
    PropertyList(eColumnDivider).AddItem "No Lines"
    PropertyList(eColumnDivider).AddItem "Black Line"
    PropertyList(eColumnDivider).AddItem "Dark Gray Line"
    PropertyList(eColumnDivider).AddItem "Raised Lines"
    PropertyList(eColumnDivider).AddItem "Inset Lines"
    PropertyList(eColumnDivider).AddItem "ForeColor"
    PropertyList(eColumnDivider).ListIndex = frmMain.MainGrid.Columns(0).DividerStyle
    
    Dim iCount As Integer
    PropertyList(eColumns).AddItem "All"
    For iCount = 1 To frmMain.MainGrid.Columns.Count
        PropertyList(eColumns).AddItem CStr(iCount)
    Next iCount
    PropertyList(eColumns).ListIndex = 1
    
    PropertyList(eColumnAlignment).AddItem "Left"
    PropertyList(eColumnAlignment).AddItem "Right"
    PropertyList(eColumnAlignment).AddItem "Centered"
    PropertyList(eColumnAlignment).AddItem "General"
    PropertyList(eColumnAlignment).ListIndex = frmMain.MainGrid.Columns(0).Alignment
End Sub

Private Sub chkDBOps_Click(Index As Integer)
    Select Case Index
        Case eAllowAddNew
            frmMain.MainGrid.AllowAddNew = chkDBOps(Index).Value
        Case eAllowDelete
            frmMain.MainGrid.AllowDelete = chkDBOps(Index).Value
        Case eAllowUpdate
            frmMain.MainGrid.AllowUpdate = chkDBOps(Index).Value
        Case eColumnHeaders
            frmMain.MainGrid.ColumnHeaders = chkDBOps(Index).Value
        Case eRecordSelectors
            frmMain.MainGrid.RecordSelectors = chkDBOps(Index).Value
        Case eAllowRowsizing
            frmMain.MainGrid.AllowRowSizing = chkDBOps(Index).Value
    End Select
End Sub

Private Sub cmdExit_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    bLoading = True
    LoadCombos
    GetExistingProperties
    bLoading = False
    Screen.MousePointer = vbDefault
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Set frmSetPreferences = Nothing
End Sub

Private Sub PropertyList_Click(Index As Integer)
    If bLoading Then Exit Sub
    Dim iCount As Integer
    Select Case Index
        Case eRowDivider
            frmMain.MainGrid.RowDividerStyle = PropertyList(Index).ListIndex
        Case eScrollBar
            frmMain.MainGrid.ScrollBars = PropertyList(Index).ListIndex
        Case eBorderStyle
            frmMain.MainGrid.BorderStyle = PropertyList(Index).ListIndex
        Case eColumnDivider
            If PropertyList(eColumns).ListIndex = 0 Then
                For iCount = 0 To frmMain.MainGrid.Columns.Count - 1
                    frmMain.MainGrid.Columns(iCount).DividerStyle = PropertyList(eColumnDivider).ListIndex
                Next iCount
            Else
                frmMain.MainGrid.Columns(PropertyList(eColumns).ListIndex - 1).DividerStyle = PropertyList(eColumnDivider).ListIndex
            End If
        Case eColumns
        Case eColumnAlignment
            If PropertyList(eColumns).ListIndex = 0 Then
                For iCount = 0 To frmMain.MainGrid.Columns.Count - 1
                    frmMain.MainGrid.Columns(iCount).Alignment = PropertyList(eColumnAlignment).ListIndex
                Next iCount
            Else
                frmMain.MainGrid.Columns(PropertyList(eColumns).ListIndex - 1).Alignment = PropertyList(eColumnAlignment).ListIndex
                frmMain.MainGrid.Columns(PropertyList(eColumns).ListIndex - 1).Locked = True
            End If
    End Select
End Sub

⌨️ 快捷键说明

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