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

📄 axgrid.ctl

📁 VB开发的USB卸载助手源码VB开发的USB卸载助手源码VB开发的USB卸载助手源码VB开发的USB卸载助手源码
💻 CTL
📖 第 1 页 / 共 5 页
字号:
VERSION 5.00
Begin VB.UserControl axgrid 
   ClientHeight    =   4545
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   7605
   EditAtDesignTime=   -1  'True
   ScaleHeight     =   303
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   507
   ToolboxBitmap   =   "axGrid.ctx":0000
   Begin VB.CommandButton cmdButton 
      Height          =   330
      Left            =   975
      Picture         =   "axGrid.ctx":0312
      Style           =   1  'Graphical
      TabIndex        =   7
      TabStop         =   0   'False
      Top             =   3735
      Visible         =   0   'False
      Width           =   285
   End
   Begin VB.CommandButton cmdLookup 
      Height          =   330
      Left            =   585
      Picture         =   "axGrid.ctx":078C
      Style           =   1  'Graphical
      TabIndex        =   6
      TabStop         =   0   'False
      Top             =   3735
      Visible         =   0   'False
      Width           =   285
   End
   Begin VB.ListBox List1 
      Appearance      =   0  'Flat
      Height          =   570
      ItemData        =   "axGrid.ctx":0C06
      Left            =   1710
      List            =   "axGrid.ctx":0C08
      TabIndex        =   5
      Top             =   3465
      Visible         =   0   'False
      Width           =   1185
   End
   Begin VB.PictureBox picSizer 
      Height          =   3855
      Left            =   135
      ScaleHeight     =   3855
      ScaleWidth      =   15
      TabIndex        =   4
      Top             =   45
      Visible         =   0   'False
      Width           =   15
   End
   Begin VB.VScrollBar scrVertical 
      Height          =   4245
      Left            =   6720
      Min             =   1
      TabIndex        =   2
      Top             =   0
      Value           =   1
      Visible         =   0   'False
      Width           =   285
   End
   Begin VB.HScrollBar scrHorizontal 
      Height          =   285
      Left            =   0
      Min             =   1
      TabIndex        =   1
      Top             =   4200
      Value           =   1
      Visible         =   0   'False
      Width           =   6735
   End
   Begin VB.TextBox txtEdit 
      BorderStyle     =   0  'None
      Height          =   195
      Left            =   5160
      TabIndex        =   0
      Top             =   3840
      Visible         =   0   'False
      Width           =   1365
   End
   Begin VB.PictureBox picGrid 
      AutoRedraw      =   -1  'True
      BackColor       =   &H00C0C0C0&
      BorderStyle     =   0  'None
      Height          =   3360
      Left            =   300
      ScaleHeight     =   224
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   388
      TabIndex        =   3
      Top             =   210
      Width           =   5820
   End
End
Attribute VB_Name = "axgrid"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Attribute VB_Ext_KEY = "PropPageWizardRun" ,"Yes"
Option Base 0

Private Const ALIGN_LEFT = 0
Private Const ALIGN_CENTER = 1
Private Const ALIGN_RIGHT = 2

Private Const ALIGNV_TOP = 0
Private Const ALIGNV_CENTER = 1
Private Const ALIGNV_BOTTOM = 2

Private Const STYLE_NORMAL = 0
Private Const STYLE_BUTTON = 1
Private Const STYLE_EDIT = 2

Private Const COLOR_GREY = &HC0C0C0
Private Const COLOR_DARKGREY = &H808080
Private Const m_BorderStyle_Def = 1
Private iBorderStyle As Integer

Public Enum axgridBorderStyleEnum
    [No Border] = 0
    [Single] = 1
    [Thin Raised] = 2
    [Thick Raised] = 3
    [Thin Inset] = 4
    [Thick Inset] = 5
    [Etched] = 6
    [Bump] = 7
End Enum

Public Enum FixedStyles
  [Flat] = 0
  [3D] = 1
End Enum

Public Enum SelectModes
  [SelectionFree] = 0
  [SelectionByRow] = 1
  [SelectionByCol] = 2
End Enum

Private sName As String
Private bColSizing As Boolean
Private bRowSizing As Boolean
Private bSizingCol As Boolean
Private bSizingRow As Boolean
Private lTopMargin As Long
Private lLeftMargin As Long
Private lRightMargin As Long
Private lBottomMargin As Long
Private lRow1 As Long
Private lCol1 As Long
Private lRow2 As Long
Private lCol2 As Long
Private bMouseDown As Boolean
Private bEditMode As Boolean
Private bytEvent As Byte
Private lblEvents As Label
Private lCols As Long
Private lRows As Long
Private bColHeader As Boolean
Private bRowHeader As Boolean
Private bShowGrid As Boolean
Private bGridSolid As Boolean
Private lGridLineColor As Long
Private bWidthOverflow As Boolean
Private bHeightOverflow As Boolean
Private bytGridLine As Byte
Private lGridHeight As Long
Private lGridWidth As Long
Private lCol As Long
Private lRow As Long
Private bRedraw As Boolean
Private lLargeVChange As Long
Private lLargeHChange As Long
Private bSelectingCols As Boolean
Private bSelectingRows As Boolean
Private bDAO As Boolean
Private bRDO As Boolean
Private bAutoNewRow As Boolean
Private LookupValues As New Collection
Private Buttons As New Collection
Private m_ListBoxRows As Integer

Private lBackColorFixed As Long, lForeColorFixed As Long, lBackColorBkg As Long
'Private lBackColorSel As Long, lForeColorSel As Long
Private bAllowSelection As Boolean, iFixedStyle As Integer, iSelectionMode As Integer
Private fFont As StdFont, fFontFixed As StdFont, sFormatString As String
Private bAllowUserResizing As Boolean

Private lCurrentRowSizer As Long
Private lCurrentColSizer As Long

Private Cells As clsCellArray
Private lRowHeight() As Integer
Private lRowBookmark() As Variant

Private lColWidth() As Integer, lColAlign() As Integer, bColEdit() As Boolean
Private lColMask() As Integer
Private hSizers As Collection
Private vSizers As Collection

Private lLeftCol As Long
Private lTopRow As Long
Private m_UseItemData As Boolean

'Private Type RECT
'    Left As Long
'    Top As Long
'    Right As Long
'    Bottom As Long
'End Type

'Private Type POINTAPI
'    x As Long
'    y As Long
'End Type

Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Boolean
Private Declare Function SetCursorPos Lib "user32" (ByVal lX As Long, ByVal lY As Long) As Boolean
Private Declare Function InvertRect Lib "user32" (ByVal hDC As Long, lpRect As RECT) As Long
Private Declare Function FrameRect Lib "user32" (ByVal hDC As Long, lpRect As RECT, ByVal hBrush As Long) As Long
Private Declare Function LineTo Lib "gdi32" (ByVal hDC As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function MoveToEx Lib "gdi32" (ByVal hDC As Long, ByVal x As Long, ByVal y As Long, ByVal lpPoint As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
Private Declare Function FillRect Lib "user32" (ByVal hDC As Long, lpRect As RECT, ByVal hBrush As Long) As Long
Private Declare Function ScrollDC Lib "user32" (ByVal hDC As Long, ByVal dx As Long, ByVal dy As Long, lprcScroll As RECT, lprcClip As RECT, ByVal hrgnUpdate As Long, lprcUpdate As RECT) As Long
Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hDC As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long

'kdq090498      added to show focus rectangle instead of black invert
Private Declare Function DrawFocusRect Lib "user32" (ByVal hDC As Long, lpRect As RECT) As Long

Private Const DT_BOTTOM = &H8
Private Const DT_CALCRECT = &H400
Private Const DT_CENTER = &H1
Private Const DT_LEFT = &H0
Private Const DT_RIGHT = &H2
Private Const DT_SINGLELINE = &H20
Private Const DT_TOP = &H0
Private Const DT_VCENTER = &H4
Private Const DT_WORDBREAK = &H10

'Flags for DrawFrameControl
Private Const DFC_CAPTION = 1            'Title bar
Private Const DFC_MENU = 2               'Menu
Private Const DFC_SCROLL = 3             'Scroll bar
Private Const DFC_BUTTON = 4             'Standard button

Private Const DFCS_CAPTIONCLOSE = &H0    'Close button
Private Const DFCS_CAPTIONMIN = &H1      'Minimize button
Private Const DFCS_CAPTIONMAX = &H2      'Maximize button
Private Const DFCS_CAPTIONRESTORE = &H3  'Restore button
Private Const DFCS_CAPTIONHELP = &H4     'Windows 95 only:
                                         'Help button

Private Const DFCS_MENUARROW = &H0       'Submenu arrow
Private Const DFCS_MENUCHECK = &H1       'Check mark
Private Const DFCS_MENUBULLET = &H2      'Bullet
Private Const DFCS_MENUARROWRIGHT = &H4

Private Const DFCS_SCROLLUP = &H0               'Up arrow of scroll
                                                'bar
Private Const DFCS_SCROLLDOWN = &H1             'Down arrow of
                                                'scroll bar
Private Const DFCS_SCROLLLEFT = &H2             'Left arrow of
                                                'scroll bar
Private Const DFCS_SCROLLRIGHT = &H3            'Right arrow of
                                                'scroll bar
Private Const DFCS_SCROLLCOMBOBOX = &H5         'Combo box scroll
                                                'bar
Private Const DFCS_SCROLLSIZEGRIP = &H8         'Size grip
Private Const DFCS_SCROLLSIZEGRIPRIGHT = &H10   'Size grip in
                                                'bottom-right
                                                'corner of window

Private Const DFCS_BUTTONCHECK = &H0      'Check box

Private Const DFCS_BUTTONRADIO = &H4     'Radio button
Private Const DFCS_BUTTON3STATE = &H8    'Three-state button
Private Const DFCS_BUTTONPUSH = &H10     'Push button

Private Const DFCS_INACTIVE = &H100      'Button is inactive
                                         '(grayed)
Private Const DFCS_PUSHED = &H200        'Button is pushed
Private Const DFCS_CHECKED = &H400       'Button is checked

Private Const DFCS_ADJUSTRECT = &H2000   'Bounding rectangle is
                                        'adjusted to exclude the
                                        'surrounding edge of the
                                        'push button

Private Const DFCS_FLAT = &H4000         'Button has a flat border
Private Const DFCS_MONO = &H8000         'Button has a monochrome
                                         'border

Private Declare Function DrawFrameControl Lib "user32" (ByVal hDC&, lpRect As RECT, ByVal un1 As Long, ByVal un2 As Long) As Boolean

'Default Property Values:
Const m_def_Recordset = 0
'Const m_def_RecordSource = 0
Const m_def_DataSource = 0

'Property Variables:
Dim m_Recordset As Variant
'Dim m_RecordSource As Variant
Dim m_DataSource As Variant

'Event EnterCell() 'MappingInfo=flxGrid,flxGrid,-1,EnterCell
'Event LeaveCell() 'MappingInfo=flxGrid,flxGrid,-1,LeaveCell
Event Click() 'MappingInfo=flxGrid,flxGrid,-1,Click
Event BtnClick(Col As Integer)
Event DblClick()
Event KeyDown(KeyCode As Integer, Shift As Integer) 'MappingInfo=flxGrid,flxGrid,-1,KeyDown
Attribute KeyDown.VB_MemberFlags = "40"
Event KeyPress(KeyAscii As Integer) 'MappingInfo=flxGrid,flxGrid,-1,KeyPress
Attribute KeyPress.VB_MemberFlags = "40"
Event KeyUp(KeyCode As Integer, Shift As Integer) 'MappingInfo=flxGrid,flxGrid,-1,KeyUp
Attribute KeyUp.VB_MemberFlags = "40"
Event MouseDown(button As Integer, Shift As Integer, x As Single, y As Single) 'MappingInfo=flxGrid,flxGrid,-1,MouseDown
Event MouseMove(button As Integer, Shift As Integer, x As Single, y As Single) 'MappingInfo=flxGrid,flxGrid,-1,MouseMove
Attribute MouseMove.VB_MemberFlags = "40"
Event MouseUp(button As Integer, Shift As Integer, x As Single, y As Single) 'MappingInfo=flxGrid,flxGrid,-1,MouseUp
Attribute MouseUp.VB_MemberFlags = "40"
Event Scroll() 'MappingInfo=flxGrid,flxGrid,-1,Scroll
Event BeforeEdit(Row As Integer, Col As Integer, ByVal Cancel As Boolean)
Event AfterEdit(Row As Integer, Col As Integer, NewValue As String)
Event BeforeAddRow(ByVal Cancel As Boolean)
Attribute BeforeAddRow.VB_Description = "Occurs before adding a new row"
Event AfterAddRow(Row As Integer)
Event BeforeDeleteRow(Row As Integer, ByVal Cancel As Boolean)
Event AfterDeleteRow(Row As Integer)

Public Property Get Rows() As Long
Attribute Rows.VB_Description = "Sets/gets the total number of rows in the grid"
    Rows = lRows
End Property

Public Property Let Rows(lNewValue As Long)
    scrVertical.Max = lNewValue
    InitializeRows lNewValue&
    lRows = lNewValue
    Refresh
End Property

Public Property Get Cols() As Long
Attribute Cols.VB_Description = "Gets/sets the total number of columns in the grid"
    Cols = lCols
End Property

Public Property Let Cols(lNewValue As Long)

    scrHorizontal.Max = lNewValue
    InitializeCols lNewValue
    lCols = lNewValue
    Refresh
End Property

Public Sub Refresh()

    Dim lThisRow As Long, lThisCol As Long
    Dim lMyColWidth As Long, lMyRowHeight As Long
    Dim lpRect As RECT
    Dim lScaleHeight As Long, lScaleWidth As Long
    
    If bRedraw = False Then Exit Sub
    
    picGrid.Cls
    If bShowGrid Then
        bytGridLine = 1
    Else
        bytGridLine = 0
    End If
    
    lScaleHeight = picGrid.ScaleHeight
    lScaleWidth = picGrid.ScaleWidth
    
    'Draw all the cells that will fit in the viewport
    RedrawAllCells True
    
    'Draw the vertical scroll bar (if necessary)
    If bHeightOverflow Then

⌨️ 快捷键说明

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