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

📄 frmunicode.frm

📁 一款Grid表格控件源代码,非常棒.不下你一定会后悔
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "*\A..\prjvhGrid.vbp"
Begin VB.Form frmUnicode 
   BackColor       =   &H00F6F6F6&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "vhGrid - Unicode"
   ClientHeight    =   7635
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   11160
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   7635
   ScaleWidth      =   11160
   StartUpPosition =   1  'CenterOwner
   Begin vhGrid.ucVHGrid ucVHGrid1 
      Height          =   6675
      Left            =   135
      TabIndex        =   1
      Top             =   180
      Width           =   10815
      _ExtentX        =   19076
      _ExtentY        =   11774
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      AlphaBarTransparency=   70
      ForeColor       =   0
      GridLines       =   0
      HeaderDragDrop  =   0   'False
      BeginProperty HeaderFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      HeaderForeColor =   0
      HeaderForeColorFocused=   0
      HeaderForeColorPressed=   0
      HeaderHeight    =   20
      HeaderHeightSizable=   -1  'True
   End
   Begin VB.CommandButton cmdPopulate 
      Caption         =   "Populate"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   -1  'True
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   420
      Left            =   9000
      TabIndex        =   0
      Top             =   7020
      Width           =   2040
   End
   Begin MSComctlLib.ImageList iml32 
      Left            =   0
      Top             =   0
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   32
      ImageHeight     =   32
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   20
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":0000
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":213A
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":3444
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":474E
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":5A58
            Key             =   ""
         EndProperty
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":6D62
            Key             =   ""
         EndProperty
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":7A6C
            Key             =   ""
         EndProperty
         BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":8CEE
            Key             =   ""
         EndProperty
         BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":AE28
            Key             =   ""
         EndProperty
         BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":C132
            Key             =   ""
         EndProperty
         BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":D43C
            Key             =   ""
         EndProperty
         BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":E746
            Key             =   ""
         EndProperty
         BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":FA50
            Key             =   ""
         EndProperty
         BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":FEA2
            Key             =   ""
         EndProperty
         BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":111AC
            Key             =   ""
         EndProperty
         BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":124B6
            Key             =   ""
         EndProperty
         BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":12908
            Key             =   ""
         EndProperty
         BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":13C12
            Key             =   ""
         EndProperty
         BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":14F1C
            Key             =   ""
         EndProperty
         BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":16226
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.ImageList imlHdr 
      Left            =   0
      Top             =   540
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   5
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":17530
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":1768A
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":177E4
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":17C36
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmUnicode.frx":18088
            Key             =   ""
         EndProperty
      EndProperty
   End
End
Attribute VB_Name = "frmUnicode"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private m_aData()    As String


Private Sub cmdPopulate_Click()

    '/* add the data
    BuildList
    
End Sub

Private Sub Form_Load()

Dim lX      As Long
Dim lCt     As Long

    '/* load res data
    LoadData
    
    With ucVHGrid1
        lX = (.Width / Screen.TwipsPerPixelX) / 8
        '/* auto set draw after last cell is loaded
        .FastLoad = True
        '/* enable unicode
        .UseUnicode = True
        '/* add header icons
        .InitImlHeader
        For lCt = 1 To 5
            .ImlHeaderAddIcon imlHdr.ListImages.Item(lCt).Picture
        Next lCt
        '/* add row icons
        .InitImlRow 32, 32
        For lCt = 1 To 20
            .ImlRowAddIcon iml32.ListImages(lCt).Picture
        Next lCt
        
        '/* add columns
        .ColumnAdd 0, "", (lX * 0.4), ecaColumnLeft, 0, ecsSortIcon
        .ColumnAdd 1, m_aData(0), (lX * 1.8), ecaColumnLeft, 1, ecsSortDefault
        .ColumnAdd 2, m_aData(1), (lX * 1.8), ecaColumnLeft, 2, ecsSortDefault
        .ColumnAdd 3, m_aData(2), (lX * 1.8), ecaColumnLeft, 3, ecsSortDefault
        .ColumnAdd 4, m_aData(3), (lX * 1.8), ecaColumnLeft, 4, ecsSortDefault
        
        '/* use xp colors
        .XPColors = True
        '/* grid backcolor
        .BackColor = &HC4B0A2
        '/* set the row height
        .RowHeight = 35
        '/* double buffer grid
        .DoubleBuffer = True
        '/* enable cell editing
        .CellEdit = True
        '/* lock the first column
        .LockFirstColumn = True
        '/* set alphbar transparency
        .AlphaBarTransparency = 120
        '/* enable sorting
        .CellsSorted = True
        '/* enable header drag and drop
        .HeaderDragDrop = True
        
        '/* set header height
        .HeaderHeight = 35
        '/* enable checkboxes
        .Checkboxes = True
        '/* use gridlines
        .GridLines = EGLBoth
        '/* set the drag effect style
        .DragEffectStyle = edsClientArrow
        '/* enable header vertical text
        .ColumnVerticalText = True
        '/* apply skin
        .ThemeManager etmAzure, False, , , &H333333, &H887466, &HC4B0A2, _
            &H887466, &HC4B0A2, &H808080, 210, True, True, &HC4B0A2, _
            True, False, True, False
        '/* apply cell decoration
        .CellDecoration erdCellBiLinear, &HF1DDCF, &HC4B0A2, True, 2
    End With
    
End Sub

Private Sub LoadData()

    '/* init temp array
    ReDim m_aData(13)
    '/* unicode: base array
    m_aData(0) = LoadResString(105)
    m_aData(1) = LoadResString(108)
    m_aData(2) = LoadResString(109)
    m_aData(3) = LoadResString(110)
    m_aData(4) = LoadResString(101) & "|" & LoadResString(121)
    m_aData(5) = LoadResString(102) & "|" & LoadResString(122)
    m_aData(6) = LoadResString(103) & "|" & LoadResString(123)
    m_aData(7) = LoadResString(104) & "|" & LoadResString(124)
    m_aData(8) = LoadResString(105) & "|" & LoadResString(125)
    m_aData(9) = LoadResString(113) & "|" & LoadResString(123)
    m_aData(10) = LoadResString(107) & "|" & LoadResString(127)
    m_aData(11) = LoadResString(108) & "|" & LoadResString(128)
    m_aData(12) = LoadResString(109) & "|" & LoadResString(129)
    m_aData(13) = LoadResString(110) & "|" & LoadResString(130)
    
End Sub

Private Sub BuildList()

Dim lCt     As Long
Dim lRnd    As Long

    With ucVHGrid1
        .GridInit 50, 5
        '/* add the rest of the rows
        For lCt = 0 To 50
            lRnd = RandomNum(3, 10)
            .AddCell lCt, 0
            .AddCell lCt, 1, m_aData(lRnd), DT_LEFT Or DT_END_ELLIPSIS, lRnd
            .AddCell lCt, 2, m_aData(lRnd), DT_LEFT Or DT_END_ELLIPSIS
            .AddCell lCt, 3, m_aData(lRnd), DT_LEFT Or DT_END_ELLIPSIS
            .AddCell lCt, 4, m_aData(lRnd), DT_LEFT Or DT_END_ELLIPSIS
        Next lCt
        '/* refresh the grid
        .GridRefresh True
    End With

End Sub

Private Function RandomNum(ByVal lBase As Long, _
                           ByVal lSpan As Long) As Long

    RandomNum = Int(Rnd() * lSpan) + lBase

End Function

⌨️ 快捷键说明

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