vb6自制控件的属性无法保存

normandj 2006-08-28 04:46:01
vb6自制控件的属性无法保存,请教原因。
那些属性是使用向导制作的,在设计模式,在属性窗口更改了数据,保存文件后,属性值变成默认值。
...全文
203 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
normandj 2006-09-05
  • 打赏
  • 举报
回复
"我知道"

知道什么?
hammer_43 2006-09-04
  • 打赏
  • 举报
回复
我知道
normandj 2006-09-01
  • 打赏
  • 举报
回复
'缺省属性值:
Const m_def_OutputStyle = 0
Const m_def_FormatString = "#,###.##"
Const m_def_OutputType = 0
'属性变量:
Dim m_OutputStyle As NumTextOutputStyle
Dim m_FormatString As String
Dim m_OutputType As NumTextNullOutput
'事件声明:
Event KeyPress(KeyAscii As Integer) 'MappingInfo=Text1,Text1,-1,KeyPress
Enum NumTextOutputStyle
[ntNoFormatStyle] = 0
[ntFormatStyle] = 1
End Enum
Enum NumTextNullOutput
[ntNullOutputNull] = 0
[ntNullOutputZero] = 1
End Enum

...............

'从存贮器中加载属性值
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)

Text1.Locked = PropBag.ReadProperty("Locked", False)
Text1.Enabled = PropBag.ReadProperty("Enabled", True)
Text1.BackColor = PropBag.ReadProperty("BackColor", &H80000005)
Text1.BorderStyle = PropBag.ReadProperty("BorderStyle", 1)
Text1.SelLength = PropBag.ReadProperty("SelLength", 0)
Text1.SelStart = PropBag.ReadProperty("SelStart", 0)
Text1.SelText = PropBag.ReadProperty("SelText", "")
m_FormatString = PropBag.ReadProperty("FormatString", m_def_FormatString)
m_OutputStyle = PropBag.ReadProperty("OutputStyle", m_def_OutputStyle)
End Sub

'将属性值写到存储器
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)

Call PropBag.WriteProperty("Locked", Text1.Locked, False)
Call PropBag.WriteProperty("Enabled", Text1.Enabled, True)
Call PropBag.WriteProperty("BackColor", Text1.BackColor, &H80000005)
Call PropBag.WriteProperty("BorderStyle", Text1.BorderStyle, 1)
Call PropBag.WriteProperty("SelLength", Text1.SelLength, 0)
Call PropBag.WriteProperty("SelStart", Text1.SelStart, 0)
Call PropBag.WriteProperty("SelText", Text1.SelText, "")
Call PropBag.WriteProperty("FormatString", m_FormatString, m_def_FormatString)
Call PropBag.WriteProperty("OutputStyle", m_OutputStyle, m_def_OutputStyle)
End Sub

.......................

'注意!不要删除或修改下列被注释的行!
'MemberInfo=24,0,0,0
Public Property Get OutputStyle() As NumTextOutputStyle
OutputStyle = m_OutputStyle
End Property

Public Property Let OutputStyle(ByVal New_OutputStyle As NumTextOutputStyle)
m_OutputStyle = New_OutputStyle
PropertyChanged "OutputStyle"
End Property
zq972 2006-08-31
  • 打赏
  • 举报
回复
代码?
guojl 2006-08-31
  • 打赏
  • 举报
回复
可能是自制控件的问题
01 , 01.txt 《 VB6.0中通过MSChart控件调用数据库 》 02 , 02.txt 《 用VB6实现动态增减控件 》 03 , 03.txt ActiveX控件的创建 04 , 04.txt ADO控件和DATA控件的冲突(不能共存)的解决方法 05 , 05.txt Combo的自动查询技术 06 , 06.txt DirectX7.0使用心得(1) 07 , 07.txt DirectX7.0使用心得(2) 08 , 08.txt DirectX7.0使用心得(3) 09 , 09.txt FSO对象模型在VB中的应用 10 , 10.txt MsComm 控件的文字传输范例 11 , 11.txt Office或IE4风格的ToolBar 12 , 12.txt Regsvr32.exe注册控件的具体用法 13 , 13.txt TextBox的自动调节 14 , 14.txt TextBox实现打印机效果 15 , 15.txt TreeView的基本操作 16 , 16.txt VB5中DBGRID控件VB6中使用 17 , 17.txt VB6.0动态加载ActiveX控件漫谈 18 , 18.txt VB与MS-Draw开发通用作图软件 19 , 19.txt VB中APP对象及其应用 20 , 20.txt VB中list控件的功能扩充 21 , 21.txt VB中防止将重复项目添加到列表框控件中 22 , 22.txt VB中用Multimedia MCI控件开发多媒体应用 23 , 23.txt Win Api在VB中的妙用 24 , 24.txt WINDOWS SCRIPT HOST对象在VB中的使用 25 , 25.txt 安装向导生成程序组并建立多个程序项 26 , 26.txt 保存复选框选项 27 , 27.txt 不用OCX来创建自己的控件(一) 28 , 28.txt 成组更新控件属性 29 , 29.txt 创建数据驱动窗体 30 , 30.txt 得到鼠标位置 31 , 31.txt 调整 Combo 下拉部分的宽度 32 , 32.txt 动态加入控件到VB控件数组中 33 , 33.txt 对ListView中的列排序 34 , 34.txt 放一个Combo到Toolbar中 35 , 35.txt 改变 ListIndex而不发生 Click 事

1,453

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧