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

normandj 2006-08-28 04:46:01
vb6自制控件的属性无法保存,请教原因。
那些属性是使用向导制作的,在设计模式,在属性窗口更改了数据,保存文件后,属性值变成默认值。
...全文
181 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
  • 打赏
  • 举报
回复
可能是自制控件的问题

1,451

社区成员

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

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