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

📄 form1.frm

📁 远程访问sql server 的源码
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3405
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7155
   LinkTopic       =   "Form1"
   ScaleHeight     =   3405
   ScaleWidth      =   7155
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdShow 
      Caption         =   "报告显示"
      Height          =   495
      Index           =   3
      Left            =   240
      TabIndex        =   4
      Top             =   2520
      Width           =   1815
   End
   Begin VB.CommandButton cmdShow 
      Caption         =   "列表显示"
      Height          =   495
      Index           =   2
      Left            =   240
      TabIndex        =   3
      Top             =   1920
      Width           =   1815
   End
   Begin VB.CommandButton cmdShow 
      Caption         =   "小图标显示"
      Height          =   495
      Index           =   1
      Left            =   240
      TabIndex        =   2
      Top             =   1320
      Width           =   1815
   End
   Begin MSComctlLib.ListView ListView1 
      Height          =   2655
      Left            =   2280
      TabIndex        =   1
      Top             =   480
      Width           =   4695
      _ExtentX        =   8281
      _ExtentY        =   4683
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      _Version        =   393217
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   1
      NumItems        =   0
   End
   Begin VB.CommandButton cmdShow 
      Caption         =   "大图标显示"
      Height          =   495
      Index           =   0
      Left            =   240
      TabIndex        =   0
      Top             =   720
      Width           =   1815
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   120
      Top             =   120
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   2
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":0000
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":031A
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.ImageList ImageList2 
      Left            =   840
      Top             =   120
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   2
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":076C
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":0A86
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.ImageList ImageList3 
      Left            =   1440
      Top             =   120
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   3
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":0ED8
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":11F2
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":150C
            Key             =   ""
         EndProperty
      EndProperty
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdShow_Click(Index As Integer)
    '利用控件数组,在程序运行时候改变列表视图的显示风格
    Select Case Index
        Case 0
            ListView1.View = lvwIcon
        Case 1
            ListView1.View = lvwSmallIcon
        Case 2
            ListView1.View = lvwList
        Case 3
            ListView1.View = lvwReport
    End Select
End Sub

Private Sub Form_Load()
    
    '设置好ListView的图像来源
    Set ListView1.Icons = ImageList1
    Set ListView1.SmallIcons = ImageList2
    Set ListView1.ColumnHeaderIcons = ImageList3
    
    '定义列表的表头,其宽度按ListView的宽度平均分配
    Dim clmHeader As ColumnHeader
    '设置三列表头,并且定义了其对应的图标
    Set clmHeader = ListView1.ColumnHeaders.Add(, , "姓名", , , 1)
    Set clmHeader = ListView1.ColumnHeaders.Add(, , "性别", , , 2)
    Set clmHeader = ListView1.ColumnHeaders.Add(, , "年龄", , , 3)
    
    '定义一个列表项对象
    Dim ltmX As ListItem
    
    Set ltmX = ListView1.ListItems.Add(, , "李存斌", 1, 1)
    '当ListView采用报告风格显示的时候,可以出现子工程
    ltmX.SubItems(1) = "男"
    ltmX.SubItems(2) = "43"
    
    Set ltmX = ListView1.ListItems.Add(, , "郭晓鹏", 2, 2)
    ltmX.SubItems(1) = "男"
    ltmX.SubItems(2) = "24"
End Sub

Private Sub ListView1_Click()
    Dim i As Integer
    'i = ListView1.SelectedItem.Index
    'MsgBox ListView1.ListItems(i).Text
    MsgBox ListView1.SelectedItem.Text
End Sub

Private Sub ListView1_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader)
    '利用SortOrder来确定排序的方式,如果当前是升序,那么就
    '改变为降序;如果是降序,则下次单击就按升序排列
    If ListView1.SortOrder = lvwAscending Then
        ListView1.SortOrder = lvwDescending
    Else
        ListView1.SortOrder = lvwAscending
    End If
    
    '列表的表头序号从1开始
    '一般而言,表头是由列表项与其子项(SubItem)共同构成
    '对于SortKey而言,如果返回0,则,表示用列表项(ListItem)
    '对象的文本来排序,如果SortKey>=1,则表示用SubItem来进行排序。
    '因此执行序号减1的操作。
    ListView1.SortKey = ColumnHeader.Index - 1
    ListView1.Sorted = True
End Sub

⌨️ 快捷键说明

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