form1.frm

来自「很好的教程原代码!」· FRM 代码 · 共 786 行 · 第 1/2 页

FRM
786
字号
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   6240
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7305
   LinkTopic       =   "Form1"
   ScaleHeight     =   6240
   ScaleWidth      =   7305
   StartUpPosition =   3  '窗口缺省
   Begin VB.CheckBox Check6 
      Caption         =   "允许自动选择"
      Height          =   420
      Left            =   4320
      TabIndex        =   23
      Top             =   2160
      Width           =   1695
   End
   Begin VB.CheckBox chkOne 
      Caption         =   "允许单击选择"
      Height          =   540
      Left            =   1800
      TabIndex        =   22
      Top             =   1680
      Width           =   1695
   End
   Begin VB.CheckBox chkTwo 
      Caption         =   "允许双击选择"
      Height          =   420
      Left            =   1800
      TabIndex        =   21
      Top             =   2160
      Width           =   1695
   End
   Begin VB.CheckBox chkHeaderFont 
      Caption         =   "删除线"
      Height          =   540
      Index           =   3
      Left            =   5520
      TabIndex        =   20
      Top             =   1800
      Width           =   1695
   End
   Begin VB.CheckBox chkHeaderFont 
      Caption         =   "下划线"
      Height          =   540
      Index           =   2
      Left            =   5520
      TabIndex        =   19
      Top             =   1440
      Width           =   1695
   End
   Begin VB.CheckBox chkHeaderFont 
      Caption         =   "斜体"
      Height          =   540
      Index           =   1
      Left            =   3720
      TabIndex        =   18
      Top             =   1800
      Width           =   1695
   End
   Begin VB.CheckBox chkHeaderFont 
      Caption         =   "黑体"
      Height          =   540
      Index           =   0
      Left            =   3720
      TabIndex        =   17
      Top             =   1440
      Width           =   1695
   End
   Begin VB.CommandButton Command1 
      Caption         =   "显示图象"
      Height          =   255
      Left            =   1800
      TabIndex        =   16
      Top             =   1440
      Width           =   1575
   End
   Begin VB.CheckBox Check5 
      Caption         =   "图象在右"
      Height          =   540
      Left            =   240
      TabIndex        =   15
      Top             =   1440
      Width           =   1695
   End
   Begin VB.CheckBox Check4 
      Caption         =   "使用平板的表头"
      Height          =   540
      Left            =   5520
      TabIndex        =   14
      Top             =   960
      Width           =   1695
   End
   Begin VB.CheckBox Check3 
      Caption         =   "允许网格"
      Height          =   540
      Left            =   3720
      TabIndex        =   13
      Top             =   960
      Width           =   1695
   End
   Begin VB.CheckBox Check2 
      Caption         =   "允许整行选择"
      Height          =   540
      Left            =   1920
      TabIndex        =   12
      Top             =   960
      Width           =   1695
   End
   Begin VB.CheckBox Check1 
      Caption         =   "允许拖拉表头 即表头调整"
      Height          =   540
      Left            =   240
      TabIndex        =   11
      Top             =   960
      Width           =   1695
   End
   Begin VB.PictureBox pixSmall 
      Appearance      =   0  'Flat
      AutoRedraw      =   -1  'True
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   240
      Left            =   6120
      Picture         =   "Form1.frx":0000
      ScaleHeight     =   240
      ScaleWidth      =   240
      TabIndex        =   8
      Top             =   5880
      Visible         =   0   'False
      Width           =   240
   End
   Begin VB.PictureBox pixDummy 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   240
      Left            =   240
      Picture         =   "Form1.frx":0102
      ScaleHeight     =   240
      ScaleWidth      =   240
      TabIndex        =   7
      Top             =   5760
      Visible         =   0   'False
      Width           =   240
   End
   Begin ComctlLib.ListView ListView1 
      Height          =   2895
      Left            =   120
      TabIndex        =   6
      Top             =   2640
      Width           =   7095
      _ExtentX        =   12515
      _ExtentY        =   5106
      View            =   3
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      _Version        =   327682
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   1
      NumItems        =   4
      BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
         Key             =   ""
         Object.Tag             =   ""
         Text            =   "名称"
         Object.Width           =   2999
      EndProperty
      BeginProperty ColumnHeader(2) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
         SubItemIndex    =   1
         Key             =   ""
         Object.Tag             =   ""
         Text            =   "大小"
         Object.Width           =   1587
      EndProperty
      BeginProperty ColumnHeader(3) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
         SubItemIndex    =   2
         Key             =   ""
         Object.Tag             =   ""
         Text            =   "类型"
         Object.Width           =   3175
      EndProperty
      BeginProperty ColumnHeader(4) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
         SubItemIndex    =   3
         Key             =   ""
         Object.Tag             =   ""
         Text            =   "日期"
         Object.Width           =   1587
      EndProperty
   End
   Begin VB.CommandButton cmdselect 
      Caption         =   "退出"
      Height          =   375
      Index           =   2
      Left            =   4560
      TabIndex        =   5
      Top             =   5760
      Width           =   1095
   End
   Begin VB.TextBox displayname 
      Height          =   270
      Left            =   1560
      TabIndex        =   3
      Text            =   "Text1"
      Top             =   600
      Width           =   3495
   End
   Begin VB.CommandButton cmdselect 
      Caption         =   "过滤"
      Height          =   375
      Index           =   1
      Left            =   3000
      TabIndex        =   2
      Top             =   5760
      Width           =   1095
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      Left            =   1560
      TabIndex        =   1
      Text            =   "Combo1"
      Top             =   240
      Width           =   3495
   End
   Begin VB.CommandButton cmdselect 
      Caption         =   "选择路径"
      Height          =   375
      Index           =   0
      Left            =   1560
      TabIndex        =   0
      Top             =   5760
      Width           =   1095
   End
   Begin VB.Label lbItemCount 
      Caption         =   "Label3"
      Height          =   255
      Left            =   120
      TabIndex        =   10
      Top             =   2400
      Width           =   1575
   End
   Begin VB.Label lbIconCount 
      Caption         =   "Label2"
      Height          =   255
      Left            =   120
      TabIndex        =   9
      Top             =   2040
      Width           =   1695
   End
   Begin ComctlLib.ImageList ImageList1 
      Left            =   6240
      Top             =   240
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   327682
      BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} 
         NumListImages   =   2
         BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "Form1.frx":0204
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "Form1.frx":0746
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin VB.Label Label1 
      Caption         =   "过滤条件"
      Height          =   375
      Index           =   0
      Left            =   360
      TabIndex        =   4
      Top             =   240
      Width           =   975
   End
   Begin VB.Menu mnuOptions 
      Caption         =   "选项"
      Visible         =   0   'False
      Begin VB.Menu mnuView 
         Caption         =   "列表"
         Index           =   0
      End
      Begin VB.Menu mnuView 
         Caption         =   "报表"
         Index           =   1
      End
      Begin VB.Menu mnuSortAZ 
         Caption         =   "排序"
      End
      Begin VB.Menu mnuSortZA 
         Caption         =   "倒序"
      End
      Begin VB.Menu zzmnuOrderBy 
         Caption         =   "按...排序"
         Begin VB.Menu mnuOrder 
            Caption         =   "名称"
            Index           =   0
         End
         Begin VB.Menu mnuOrder 
            Caption         =   "大小"
            Index           =   1
         End
         Begin VB.Menu mnuOrder 
            Caption         =   "类别"
            Index           =   2
         End
         Begin VB.Menu mnuOrder 
            Caption         =   "日期"
            Index           =   3
         End
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim UpdateFrequency  As Integer
Dim fPath As String
Dim prevOrder As Integer
Dim DOSExeIconLoaded As Boolean
Dim bState As Boolean, imgPosition As Long
Dim hHeaderFont As Long

Private Sub Check1_Click()
    Dim rStyle As Long
    Dim r As Long
    rStyle = SendMessageLong(ListView1.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
    If Check1.Value = 0 Then
        rStyle = rStyle Xor LVS_EX_HEADERDRAGDROP
    ElseIf Check1.Value = 1 Then
        rStyle = rStyle Or LVS_EX_HEADERDRAGDROP
    End If
    r = SendMessageLong(ListView1.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle)
End Sub

Private Sub Check2_Click()
    Dim rStyle As Long
    Dim r As Long
    rStyle = SendMessageLong(ListView1.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
    If Check2.Value = 0 Then         'remove the extended style bit
        rStyle = rStyle Xor LVS_EX_FULLROWSELECT
    ElseIf Check2.Value = 1 Then
        rStyle = rStyle Or LVS_EX_FULLROWSELECT
    End If
    r = SendMessageLong(ListView1.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle)
End Sub

Private Sub Check3_Click()
    Dim rStyle As Long
    Dim r As Long
    rStyle = SendMessageLong(ListView1.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
    If Check3.Value = 0 Then
        rStyle = rStyle Xor LVS_EX_GRIDLINES
    ElseIf Check3.Value = 1 Then
        rStyle = rStyle Or LVS_EX_GRIDLINES
    End If
    r = SendMessageLong(ListView1.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle)
End Sub

Private Sub Check4_Click()
     Dim r As Long
     Dim style As Long
     Dim hHeader As Long
     hHeader = SendMessageLong(ListView1.hwnd, LVM_GETHEADER, 0, ByVal 0&)
     style = GetWindowLong(hHeader, GWL_STYLE)
     style = style Xor HDS_BUTTONS
     If style Then
         r = SetWindowLong(hHeader, GWL_STYLE, style)
         r = SetWindowPos(ListView1.hwnd, Form1.hwnd, 0, 0, 0, 0, SWP_FLAGS)
     End If
End Sub

Private Sub Check5_Click()
   If Check5 Then
       imgPosition = HDF_BITMAP_ON_RIGHT
   Else
       imgPosition = HDF_BITMAP
   End If
End Sub

⌨️ 快捷键说明

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