1 Star 0 Fork 12

啊实打实/tkinter-designer

forked from 刘元涛/tkinter-designer 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Dictionary.cls 2.44 KB
一键复制 编辑 原始数据 按行查看 历史
cdhigh 提交于 2012-11-22 21:46 . v1.2.6
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "Dictionary"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Option Explicit
'SCRIPTING.DICTIONARY的简单封装
Private m_dic As Object
Public Sub Add(ByVal sK As String, sV As Variant)
m_dic.Add sK, sV
End Sub
Public Property Get Item(ByVal sK As String) As String
Attribute Item.VB_UserMemId = 0
Item = m_dic.Item(sK)
End Property
Public Property Let Item(ByVal sK As String, sV As String)
m_dic.Item(sK) = sV
End Property
Public Function Exists(ByVal sK As String) As Boolean
Exists = m_dic.Exists(sK)
End Function
Public Function Keys() As Collection
'Set Keys = m_Dic.Keys
Set Keys = New Collection
Dim k As Variant
For Each k In m_dic
Keys.Add k
Next
End Function
Public Function Items() As Collection
'Set Items = m_Dic.Items
Set Items = New Collection
Dim k As Variant
For Each k In m_dic
Items.Add m_dic.Item(k)
Next
End Function
Public Sub Remove(sKey As String)
If m_dic.Exists(sKey) Then m_dic.Remove sKey
End Sub
Public Sub RemoveAll()
m_dic.RemoveAll
End Sub
Public Property Get Count() As Long
Count = m_dic.Count
End Property
'对象序列化函数
Public Function Serializer(vSer As clsSerialization)
Dim k As Variant
vSer.Serializer m_dic.Count
For Each k In m_dic
vSer.Serializer k, m_dic(k)
Next
End Function
Public Function Deserializer(vSer As clsSerialization)
Dim nCount As Long, i As Long, k As Variant, v As Variant
m_dic.RemoveAll
vSer.Deserializer nCount
For i = 0 To nCount - 1
vSer.Deserializer k, v
m_dic.Add k, v
Next
End Function
Private Sub Class_Initialize()
Set m_dic = CreateObject("Scripting.Dictionary")
If m_dic Is Nothing Then
MsgBox L("l_msgCreateDictionaryFailed", "创建Scripting.Dictionary对象失败,程序无法继续执行。\n请确认scrrun.dll是否存在!"), vbCritical
End If
End Sub
Private Sub Class_Terminate()
Set m_dic = Nothing
End Sub
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Visual Basic
1
https://gitee.com/ah-actually/tkinter-designer.git
[email protected]:ah-actually/tkinter-designer.git
ah-actually
tkinter-designer
tkinter-designer
master

搜索帮助