📄 listview.ctl
字号:
Refresh
End Sub
Public Property Get ColumnCount() As Long
ColumnCount = m_colColumns.Count
End Property
Public Property Get ColumnKey(Index) As String
ColumnKey = m_colColumns.Item(Index).key
End Property
Public Property Get ColumnsVisible() As Boolean
ColumnsVisible = m_blnColumnsVisible
End Property
Public Property Let ColumnsVisible(ByVal blnVal As Boolean)
m_blnColumnsVisible = blnVal
Refresh
PropertyChanged "ColumnsVisible"
End Property
Public Property Get ColumnVisible(Index) As Boolean
ColumnVisible = m_colColumns.Item(Index).Visible
End Property
Public Property Let ColumnVisible(Index, ByVal blnVis As Boolean)
m_colColumns.Item(Index).Visible = blnVis
Refresh
End Property
Public Property Get ColumnCaption(Index) As String
ColumnCaption = m_colColumns.Item(Index).Caption
End Property
Public Property Let ColumnCaption(Index, ByVal strCaption As String)
m_colColumns.Item(Index).Caption = strCaption
DrawListView
End Property
Public Property Get ColumnWidth(Index) As Long
ColumnWidth = m_colColumns.Item(Index).Width
End Property
Public Property Let ColumnWidth(Index, ByVal lngWidth As Long)
m_colColumns.Item(Index).Width = lngWidth
Refresh
End Property
Public Property Get ColumnResizable(Index) As Boolean
ColumnResizable = m_colColumns.Item(Index).Resizable
End Property
Public Property Let ColumnResizable(Index, ByVal blnRes As Boolean)
m_colColumns.Item(Index).Resizable = blnRes
Refresh
End Property
Public Property Get ColumnTextAlign(Index) As TextAlignConstants
ColumnTextAlign = m_colColumns.Item(Index).TextAlign
End Property
Public Property Let ColumnTextAlign(Index, ByVal udeAlign As TextAlignConstants)
m_colColumns.Item(Index).TextAlign = udeAlign
DrawListView
End Property
' ************************************************
' *** Einstellungen ***
' ************************************************
Public Property Get Sortable() As Boolean
Sortable = m_blnSortable
End Property
Public Property Let Sortable(ByVal blnVal As Boolean)
m_blnSortable = blnVal
PropertyChanged "Sortable"
End Property
Public Property Get ItemsAutoSize() As Boolean
ItemsAutoSize = m_blnItemAutoSize
End Property
Public Property Let ItemsAutoSize(ByVal blnVal As Boolean)
m_blnItemAutoSize = blnVal
DrawListView
PropertyChanged "ItemsAutoSize"
End Property
Public Property Get PictureHeight() As Long
PictureHeight = m_lngPictureHeight
End Property
Public Property Let PictureHeight(ByVal lngVal As Long)
m_lngPictureHeight = lngVal
DrawListView
PropertyChanged "PictureHeight"
End Property
Public Property Get PictureWidth() As Long
PictureWidth = m_lngPictureWidth
End Property
Public Property Let PictureWidth(ByVal lngVal As Long)
m_lngPictureWidth = lngVal
DrawListView
PropertyChanged "PictureWidth"
End Property
Public Property Get PicturesVisible() As Boolean
PicturesVisible = m_blnShowPictures
End Property
Public Property Let PicturesVisible(ByVal blnVal As Boolean)
m_blnShowPictures = blnVal
Refresh
PropertyChanged "PicturesVisible"
End Property
Public Property Get ItemPaddingTop() As Long
ItemPaddingTop = m_lngPaddingTop
End Property
Public Property Let ItemPaddingTop(ByVal lngVal As Long)
m_lngPaddingTop = lngVal
PropertyChanged "ItemPaddingTop"
Refresh
End Property
Public Property Get ItemPaddingBottom() As Long
ItemPaddingBottom = m_lngPaddingBottom
End Property
Public Property Let ItemPaddingBottom(ByVal lngVal As Long)
m_lngPaddingBottom = lngVal
PropertyChanged "ItemPaddingBottom"
Refresh
End Property
Public Property Get ItemPaddingLeft() As Long
ItemPaddingLeft = m_lngPaddingLeft
End Property
Public Property Let ItemPaddingLeft(ByVal lngVal As Long)
m_lngPaddingLeft = lngVal
DrawListView
PropertyChanged "ItemPaddingLeft"
End Property
Public Property Get ItemPaddingRight() As Long
ItemPaddingRight = m_lngPaddingRight
End Property
Public Property Let ItemPaddingRight(ByVal lngVal As Long)
m_lngPaddingRight = lngVal
DrawListView
PropertyChanged "ItemPaddingRight"
End Property
Public Property Get Checkboxes() As Boolean
Checkboxes = m_blnCheckBoxes
End Property
Public Property Let Checkboxes(ByVal blnVal As Boolean)
m_blnCheckBoxes = blnVal
DrawListView
PropertyChanged "Checkboxes"
End Property
Public Property Get OLEDropMode() As OLEDropModeConstants
OLEDropMode = UserControl.OLEDropMode
End Property
Public Property Let OLEDropMode(ByVal intVal As OLEDropModeConstants)
UserControl.OLEDropMode = intVal
PropertyChanged "OLEDropMode"
End Property
Public Property Get SolidFocusRect() As Boolean
SolidFocusRect = m_blnSolidFocusRect
End Property
Public Property Let SolidFocusRect(ByVal blnVal As Boolean)
m_blnSolidFocusRect = blnVal
DrawListView
End Property
Public Property Get DrawCallback() As ICustomDraw
Set DrawCallback = m_clsCustDrawCB
End Property
Public Property Set DrawCallback(ByVal cls As ICustomDraw)
If cls Is Nothing Then
Set m_clsCustDrawCB = Me
Else
Set m_clsCustDrawCB = cls
End If
DrawListView
End Property
Public Property Get BorderStyle() As LVBorderStyleConstants
BorderStyle = m_udeBorderStyle
End Property
Public Property Let BorderStyle(ByVal udeBS As LVBorderStyleConstants)
m_udeBorderStyle = udeBS
pvSetBorderStyle UserControl.hwnd, m_udeBorderStyle
PropertyChanged "BorderStyle"
End Property
Public Property Get Enabled() As Boolean
Enabled = m_blnEnabled
End Property
Public Property Let Enabled(ByVal blnValue As Boolean)
m_blnEnabled = blnValue
Refresh
PropertyChanged "Enabled"
End Property
Public Property Get ColumnsAutoSize() As Boolean
ColumnsAutoSize = m_blnColumnsAutoSize
End Property
Public Property Let ColumnsAutoSize(ByVal blnValue As Boolean)
m_blnColumnsAutoSize = blnValue
Refresh
PropertyChanged "ColumnsAutoSize"
End Property
Public Property Get Reorder() As Boolean
Reorder = m_blnReorder
End Property
Public Property Let Reorder(ByVal blnValue As Boolean)
m_blnReorder = blnValue
PropertyChanged "Reorder"
End Property
Public Property Get MultiSelect() As Boolean
MultiSelect = m_blnMultiSelect
End Property
Public Property Let MultiSelect(ByVal blnValue As Boolean)
m_blnMultiSelect = blnValue
PropertyChanged "MultiSelect"
End Property
Public Property Get CheckboxColor() As ole_color
CheckboxColor = m_clsCheckBoxColor.OLEColor
End Property
Public Property Let CheckboxColor(ByVal lngOleColor As ole_color)
m_clsCheckBoxColor.SetColor lngOleColor, , True
DrawListView
PropertyChanged "CheckboxColor"
End Property
Public Property Get CheckboxSelectedColor() As ole_color
CheckboxSelectedColor = m_clsCheckBoxSelColor.OLEColor
End Property
Public Property Let CheckboxSelectedColor(ByVal lngOleColor As ole_color)
m_clsCheckBoxSelColor.SetColor lngOleColor, , True
DrawListView
PropertyChanged "CheckboxSelectedColor"
End Property
Public Property Get BackColor() As ole_color
BackColor = m_clsBackColor.OLEColor
End Property
Public Property Let BackColor(ByVal lngOleColor As ole_color)
m_clsBackColor.SetColor lngOleColor, True
DrawListView
PropertyChanged "BackColor"
End Property
Public Property Get ForeColor() As ole_color
ForeColor = m_clsForeColor.OLEColor
End Property
Public Property Let ForeColor(ByVal lngOleColor As ole_color)
m_clsForeColor.SetColor lngOleColor
DrawListView
PropertyChanged "ForeColor"
End Property
Public Property Get SelectedForeColor() As ole_color
SelectedForeColor = m_clsSelectedForeColor.OLEColor
End Property
Public Property Let SelectedForeColor(ByVal lngOleColor As ole_color)
m_clsSelectedForeColor.SetColor lngOleColor
DrawListView
PropertyChanged "SelectedForeColor"
End Property
Public Property Get SelectedBackColor() As ole_color
SelectedBackColor = m_clsSelectedBackColor.OLEColor
End Property
Public Property Let SelectedBackColor(ByVal lngOleColor As ole_color)
m_clsSelectedBackColor.SetColor lngOleColor, True
DrawListView
PropertyChanged "SelectedBackColor"
End Property
Public Property Get FocusRectColor() As ole_color
FocusRectColor = m_clsFocusRectColor.OLEColor
End Property
Public Property Let FocusRectColor(ByVal lngOleColor As ole_color)
m_clsFocusRectColor.SetColor lngOleColor, False, True
If m_hDCBack <> 0 Then SelectObject m_hDCBack, m_clsFocusRectColor.GDIPen
DrawListView
PropertyChanged "FocusRectColor"
End Property
Public Property Get Font() As StdFont
Set Font = m_clsFont
End Property
Public Property Set Font(ByVal clsNewFont As StdFont)
Set m_clsFont = clsNewFont
Refresh
PropertyChanged "Font"
End Property
Public Property Get Redraw() As Boolean
Attribute Redraw.VB_MemberFlags = "400"
Redraw = m_blnRedraw
End Property
Public Property Let Redraw(ByVal blnVal As Boolean)
m_blnRedraw = blnVal
If m_blnRedraw Then Refresh
End Property
Private Sub DrawListView()
Dim udtUCRect As RECT
Dim X As Long
Dim ps As PAINTSTRUCT
Static Redrawing As Boolean
If Not m_blnRedraw Then Exit Sub
If Redrawing Then
' we don't want to get recursion here at any time
Exit Sub
Else
Redrawing = True
With UserControl
If m_lngColumnsWidth > m_udtUCRect.X2 Then
udtUCRect.X2 = m_lngColumnsWidth
Else
udtUCRect.X2 = .ScaleWidth
End If
udtUCRect.Y2 = .ScaleHeight
End With
If m_hDCBack <> 0 Then
' BeginPaint really faster?
BeginPaint UserControl.hwnd, ps
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -