📄 splistheaders.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "spListHeaders"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder" ,"Yes"
Attribute VB_Ext_KEY = "Collection" ,"spListHeader"
Attribute VB_Ext_KEY = "Member0" ,"spListHeader"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
'=============================================================================================
'源程序名称:splistheaders.bas
' 模块名称:splistheaders
' 功能说明:超级列表头信息
' 相关文档:无
' 作者:chengyanjun
' 审核:无
'=============================================================================================
'功能: 超级列表头信息
Private mCol As Collection
'局部变量保存属性值
Private mvarSUBIndex As Integer '本地复本
'local variable(s) to hold property value(s)
Private mvarvName As String 'local copy
Private mvarisTwoS As Variant 'local copy
Private mvarViewNo As String 'local copy
Private mvarother As String 'local copy
'local variable(s) to hold property value(s)
Private mvarReadOnly As Boolean 'local copy
Public Property Let ReadOnly(ByVal vData As Boolean)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.ReadOnly = 5
mvarReadOnly = vData
End Property
Public Property Get ReadOnly() As Boolean
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.ReadOnly
ReadOnly = mvarReadOnly
End Property
Public Property Let other(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.other = 5
mvarother = vData
End Property
Public Property Get other() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.other
other = mvarother
End Property
Public Property Let ViewNo(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.ViewNo = 5
mvarViewNo = vData
End Property
Public Property Get ViewNo() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.ViewNo
ViewNo = mvarViewNo
End Property
Public Property Let isTwoS(ByVal vData As Variant)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.isTwoS = 5
mvarisTwoS = vData
End Property
Public Property Set isTwoS(ByVal vData As Variant)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.isTwoS = Form1
Set mvarisTwoS = vData
End Property
Public Property Get isTwoS() As Variant
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.isTwoS
If IsObject(mvarisTwoS) Then
Set isTwoS = mvarisTwoS
Else
isTwoS = mvarisTwoS
End If
End Property
Public Property Let vName(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.vName = 5
mvarvName = vData
End Property
Public Property Get vName() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.vName
vName = mvarvName
End Property
Public Property Get SUBIndex(strkey As String) As Integer
'当检索属性值时在参数右边使用。
'Syntax: Debug.Print X.SUBIndex
Dim i As Integer
i = 0
For i = 1 To Me.Count
If Me(i).key = strkey Then
Exit For
End If
Next
SUBIndex = i
End Property
Public Function Add(caption As String, key As String, Optional Width As Integer = 1000, _
Optional FormatStr As String = "", Optional ReadOnly As Boolean = True, _
Optional DataType As Integer = 0, Optional DataWidth As Integer = 10, _
Optional RefType As Integer = 0, _
Optional PointNum As Integer = 2, _
Optional sKey As String, _
Optional Other1 As String = "", _
Optional Other2 As String = "", _
Optional POS As Integer = 0, _
Optional HAlignment As Integer = 4, _
Optional TAlignment As Integer = 4, _
Optional CanSet As Boolean = True, _
Optional ColMerge As Boolean = False, _
Optional Visible As Boolean = True, _
Optional DispTrue As String = "", _
Optional DispFalse As String = "", _
Optional DispNull As String = "", _
Optional CanFilter As Boolean = False, _
Optional condValue1 As String = "", _
Optional CondValue2 As String = "", _
Optional FormatType As Integer = 1 _
) As spListHeader
'创建新对象
' Optional typePER As String = "", _
Dim objNewMember As spListHeader
Set objNewMember = New spListHeader
'设置传入方法的属性
With objNewMember
.FormatStr = FormatStr
.key = key
.caption = caption
.Width = Width
.DataType = DataType
.ReadOnly = ReadOnly
.PointNum = PointNum
.DataWidth = DataWidth
.RefType = RefType
'.sType = typePER
.Other1 = Other1
.Other2 = Other2
.POS = POS
.HAlignment = HAlignment
.TAlignment = TAlignment
.CanSet = CanSet
.ColMerge = ColMerge
.Visible = Visible
.DispTrue = DispTrue
.DispFalse = DispFalse
.DispNull = DispNull
.CanFilter = CanFilter
.condValue1 = condValue1
.CondValue2 = CondValue2
.FormatType = FormatType
End With
If Len(sKey) = 0 Then
mCol.Add objNewMember, key
Else
mCol.Add objNewMember, sKey
End If
'返回已创建的对象
Set Add = objNewMember
Set objNewMember = Nothing
End Function
Public Property Get Item(vntIndexKey As Variant) As spListHeader
Attribute Item.VB_UserMemId = 0
'引用集合中的一个元素时使用。
'vntIndexKey 包含集合的索引或关键字,
'这是为什么要声明为 Variant 的原因
'语法:Set foo = x.Item(xyz) or Set foo = x.Item(5)
On Error Resume Next
Set Item = mCol(vntIndexKey)
End Property
Public Property Get Count() As Long
'检索集合中的元素数时使用。语法:Debug.Print x.Count
Count = mCol.Count
End Property
Public Sub Remove(vntIndexKey As Variant)
'删除集合中的元素时使用。
'vntIndexKey 包含索引或关键字,这是为什么要声明为 Variant 的原因
'语法:x.Remove(xyz)
mCol.Remove vntIndexKey
End Sub
Public Property Get NewEnum() As IUnknown
Attribute NewEnum.VB_UserMemId = -4
Attribute NewEnum.VB_MemberFlags = "40"
'本属性允许用 For...Each 语法枚举该集合。
Set NewEnum = mCol.[_NewEnum]
End Property
Private Sub Class_Initialize()
'创建类后创建集合
Set mCol = New Collection
End Sub
Private Sub Class_Terminate()
'类终止后破坏集合
Set mCol = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -