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

📄 form1.frm

📁 这里有很多很实用的VB编程案例,方便大家学习VB.
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Begin VB.Form Form1 
   Caption         =   "ListView控件属性"
   ClientHeight    =   5925
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7305
   LinkTopic       =   "Form1"
   ScaleHeight     =   5925
   ScaleWidth      =   7305
   StartUpPosition =   3  '窗口缺省
   Begin VB.CheckBox Check6 
      Caption         =   "允许自动选择"
      Height          =   420
      Left            =   4320
      TabIndex        =   21
      Top             =   1920
      Width           =   1695
   End
   Begin VB.CheckBox chkOne 
      Caption         =   "允许单击选择"
      Height          =   540
      Left            =   1800
      TabIndex        =   20
      Top             =   1440
      Width           =   1695
   End
   Begin VB.CheckBox chkTwo 
      Caption         =   "允许双击选择"
      Height          =   420
      Left            =   1800
      TabIndex        =   19
      Top             =   1920
      Width           =   1695
   End
   Begin VB.CheckBox chkHeaderFont 
      Caption         =   "删除线"
      Height          =   540
      Index           =   3
      Left            =   5520
      TabIndex        =   18
      Top             =   1560
      Width           =   1695
   End
   Begin VB.CheckBox chkHeaderFont 
      Caption         =   "下划线"
      Height          =   540
      Index           =   2
      Left            =   5520
      TabIndex        =   17
      Top             =   1200
      Width           =   1695
   End
   Begin VB.CheckBox chkHeaderFont 
      Caption         =   "斜体"
      Height          =   540
      Index           =   1
      Left            =   3720
      TabIndex        =   16
      Top             =   1560
      Width           =   1695
   End
   Begin VB.CheckBox chkHeaderFont 
      Caption         =   "黑体"
      Height          =   540
      Index           =   0
      Left            =   3720
      TabIndex        =   15
      Top             =   1200
      Width           =   1695
   End
   Begin VB.CommandButton Command1 
      Caption         =   "显示图象"
      Height          =   255
      Left            =   1800
      TabIndex        =   14
      Top             =   1200
      Width           =   1575
   End
   Begin VB.CheckBox Check5 
      Caption         =   "图象在右"
      Height          =   540
      Left            =   240
      TabIndex        =   13
      Top             =   1200
      Width           =   1695
   End
   Begin VB.CheckBox Check4 
      Caption         =   "使用平板的表头"
      Height          =   540
      Left            =   5520
      TabIndex        =   12
      Top             =   720
      Width           =   1695
   End
   Begin VB.CheckBox Check3 
      Caption         =   "允许网格"
      Height          =   540
      Left            =   3720
      TabIndex        =   11
      Top             =   720
      Width           =   1695
   End
   Begin VB.CheckBox Check2 
      Caption         =   "允许整行选择"
      Height          =   540
      Left            =   1920
      TabIndex        =   10
      Top             =   720
      Width           =   1695
   End
   Begin VB.CheckBox Check1 
      Caption         =   "允许拖拉表头 即表头调整"
      Height          =   540
      Left            =   240
      TabIndex        =   9
      Top             =   720
      Width           =   1695
   End
   Begin VB.PictureBox pixSmall 
      Appearance      =   0  'Flat
      AutoRedraw      =   -1  'True
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   240
      Left            =   5880
      Picture         =   "Form1.frx":0000
      ScaleHeight     =   240
      ScaleWidth      =   240
      TabIndex        =   8
      Top             =   5640
      Visible         =   0   'False
      Width           =   240
   End
   Begin VB.PictureBox pixDummy 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   240
      Left            =   120
      Picture         =   "Form1.frx":0102
      ScaleHeight     =   240
      ScaleWidth      =   240
      TabIndex        =   7
      Top             =   5280
      Visible         =   0   'False
      Width           =   240
   End
   Begin ComctlLib.ListView ListView1 
      Height          =   2895
      Left            =   120
      TabIndex        =   6
      Top             =   2400
      Width           =   7095
      _ExtentX        =   12515
      _ExtentY        =   5106
      View            =   3
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      _Version        =   327682
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   1
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      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             =   5520
      Width           =   1095
   End
   Begin VB.TextBox displayname 
      Height          =   270
      Left            =   1560
      TabIndex        =   3
      Text            =   "Text1"
      Top             =   360
      Width           =   3495
   End
   Begin VB.CommandButton cmdselect 
      Caption         =   "过滤"
      Height          =   375
      Index           =   1
      Left            =   3000
      TabIndex        =   2
      Top             =   5520
      Width           =   1095
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      ItemData        =   "Form1.frx":0204
      Left            =   1560
      List            =   "Form1.frx":0206
      TabIndex        =   1
      Text            =   "Combo1"
      Top             =   0
      Width           =   3495
   End
   Begin VB.CommandButton cmdselect 
      Caption         =   "选择路径"
      Height          =   375
      Index           =   0
      Left            =   1560
      TabIndex        =   0
      Top             =   5520
      Width           =   1095
   End
   Begin ComctlLib.ImageList ImageList1 
      Left            =   6240
      Top             =   120
      _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":0208
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "Form1.frx":074A
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin VB.Label Label1 
      Caption         =   "过滤条件"
      Height          =   180
      Left            =   360
      TabIndex        =   4
      Top             =   0
      Width           =   720
   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 zzmnuSep1 
         Caption         =   "_"
      End
      Begin VB.Menu mnuSortAZ 
         Caption         =   "排序"
      End
      Begin VB.Menu mnuSortZA 
         Caption         =   "倒序"
      End
      Begin VB.Menu zzmnuSep2 
         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 Function GetHiWord(dw As Long) As Integer
    If dw And &H80000000 Then
        GetHiWord = (dw \ 65535) - 1
    Else
        GetHiWord = dw \ 65535
    End If
End Function
Private Function InitializeImageList() As Boolean
    On Local Error GoTo InitializeError
    Set ListView1.SmallIcons = Nothing
    ImageList1.ListImages.Clear
    ImageList1.ListImages.Add , "dummy", pixDummy.Picture
    Set ListView1.SmallIcons = ImageList1
    InitializeImageList = True
    Exit Function
InitializeError:
    InitializeImageList = False
End Function
Private Function vbAddFileItemIcon(hImgSmall&) As Long
    Dim r As Long
    pixSmall.Picture = LoadPicture()
    r& = ImageList_Draw(hImgSmall&, shinfo.iIcon, pixSmall.hdc, 0, 0, ILD_TRANSPARENT)
    pixSmall.Picture = pixSmall.Image
    vbAddFileItemIcon& = hImgSmall&
End Function
Public Sub ShowHeaderIcon(colNo As Long, imgIconNo As Long, _
    justify As Long, showImage As Long)
    Dim r As Long
    Dim hHeader As Long
    Dim HD As HD_ITEM
    hHeader = SendMessageLong(ListView1.hwnd, LVM_GETHEADER, 0, 0)
    With HD
      .mask = HDI_IMAGE Or HDI_FORMAT
      .fmt = HDF_LEFT Or HDF_STRING Or justify Or showImage
      .pszText = ListView1.ColumnHeaders(colNo + 1).Text
      If showImage Then .iImage = imgIconNo
   End With
   r = SendMessageAny(hHeader, HDM_SETITEM, colNo, HD)
End Sub

Private Sub SetHeaderFontStyle()
   Dim LF As LOGFONT
   Dim r As Long
   Dim hCurrFont As Long
   Dim hOldFont As Long
   Dim hHeader As Long
   hHeader = SendMessageLong(ListView1.hwnd, LVM_GETHEADER, 0, 0)
   hCurrFont = SendMessageLong(hHeader, WM_GETFONT, 0, 0)

   r = GetObject(hCurrFont, Len(LF), LF)
   If r > 0 Then
      If chkHeaderFont(optBold).Value = 1 Then
        LF.lfWeight = FW_BOLD
      Else: LF.lfWeight = FW_NORMAL
      End If
      LF.lfItalic = chkHeaderFont(optItalic).Value = 1
      LF.lfUnderline = chkHeaderFont(optUnderlined).Value = 1

⌨️ 快捷键说明

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