注册 登录
编程论坛 VB6论坛

vb6 用户控件 Picture 出错 求帮助呀。。

tan2831578 发布于 2012-08-08 10:50, 575 次点击
Private Sub TTAMKJ1_Click() 'ttakj1 是用户控件的名称
 TTAMKJ.Picture = Picture1.Picture
 TTAMKJ.MaskPicture = Picture1.Picture
End Sub
用户控件代码:
Public Property Get Picture() As Picture
    Set Picture = UserControl.Picture
End Property

Public Property Set Picture(ByVal New_Picture As Picture)
    Set UserControl.Picture = New_Picture
    PropertyChanged "Picture"
End Property

'注意!不要删除或修改下列被注释的行!
'MappingInfo=UserControl,UserControl,-1,Image
Public Property Get Image() As Picture
    Set Image = UserControl.Image
End Property

'注意!不要删除或修改下列被注释的行!
'MemberInfo=8,0,0,
Public Property Get MaskColor() As Long
    MaskColor = UserControl.MaskColor
End Property

Public Property Let MaskColor(ByVal New_MaskColor As Long)
    UserControl.MaskColor = New_MaskColor
    PropertyChanged "MaskColor"
End Property

'注意!不要删除或修改下列被注释的行!
'MemberInfo=11,0,0,
Public Property Get MaskPicture() As Picture
    Set MaskPicture = UserControl.MaskPicture
End Property

Public Property Set MaskPicture(ByVal New_MaskPicture As Picture)
    Set UserControl.MaskPicture = New_MaskPicture
    PropertyChanged "MaskPicture"
End Property
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)

    UserControl.BackColor = PropBag.ReadProperty("BackColor", &H0&)
    UserControl.BackStyle = PropBag.ReadProperty("BackStyle", 0)
    UserControl.BorderStyle = PropBag.ReadProperty("BorderStyle", 0)
    UserControl.ForeColor = PropBag.ReadProperty("ForeColor", &H80000012)
    UserControl.Enabled = PropBag.ReadProperty("Enabled", True)
    UserControl.FillStyle = PropBag.ReadProperty("FillStyle", 1)
    UserControl.FillColor = PropBag.ReadProperty("FillColor", &H0&)
    Set UserControl.Picture = PropBag.ReadProperty("Picture", Nothing)
    UserControl.MaskColor = PropBag.ReadProperty("MaskColor", 0)
    Set UserControl.MaskPicture = PropBag.ReadProperty("MaskPicture", Nothing)
    Set UserControl.Font = PropBag.ReadProperty("Font", Ambient.Font)
    m_Caption = PropBag.ReadProperty("Caption", m_def_Caption)
End Sub

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

    Call PropBag.WriteProperty("BackColor", UserControl.BackColor, &H0&)
    Call PropBag.WriteProperty("BackStyle", UserControl.BackStyle, 0)
    Call PropBag.WriteProperty("BorderStyle", UserControl.BorderStyle, 0)
    Call PropBag.WriteProperty("MaskPicture", MaskPicture, 0)
    Call PropBag.WriteProperty("Picture", Picture, 0)
    Call PropBag.WriteProperty("ForeColor", UserControl.ForeColor, &H80000012)
    Call PropBag.WriteProperty("Enabled", UserControl.Enabled, True)
    Call PropBag.WriteProperty("FillStyle", UserControl.FillStyle, 1)
    Call PropBag.WriteProperty("FillColor", UserControl.FillColor, &H0&)
    Call PropBag.WriteProperty("Picture", Picture, Nothing)
    Call PropBag.WriteProperty("MaskColor", UserControl.MaskPicture, m_def_MaskColor)
    Call PropBag.WriteProperty("MaskPicture", UserControl.MaskPicture, Nothing)
    Call PropBag.WriteProperty("Font", UserControl.Font, Ambient.Font)
    Call PropBag.WriteProperty("Caption", m_Caption, m_def_Caption)
End Sub




不知道哪里出错 求指点!!
1 回复
#2
风吹过b2012-08-08 16:44
报什么错???

----------------------------------------
为了这个代码,去认真研究几十分钟作静态分析???估计没有人去干了,现在都是动态分析的。
为了这个代码,去猜测你的控件结构??? 那再没人去干了。

所以,问问题时,哪一行在运行时报错,报什么错,要发出来,大家才会去看看。
1