我的自制控件中有两个image控件,我用接口向导将两个字定义属性p1、p2绑定到两个image的picture属性上,在设计时,可以在属性窗口中设置p1、p2,也能看到效果,但是一运行,图片就不见了。请问如何解决?当然,不在属性窗口中设置,在代码中写p1=loadpicture(xx)当然可以,但是觉得不够友好。
还有,我想制作一个属性用于保存控件对象,应该如何写接口?
请教!
还有,我想制作一个属性用于保存控件对象,应该如何写接口?
请教!
解决方案 »
- 通过VB代码 想在打开的Excel对象里面插入列
- 图像拷贝代码
- 想把picturebox控件中所画的线条存成16色的BMP位图如何怎样实现?
- 在vba中,用Cells.Value取出来的值 不等于看到的值
- 怎么用VB将Access的一个表中数据复制到excell的某个页面中?
- 急!!!如何将form中的文本(比如text的值)添加到CrystalReport中
- 一个有难度的问题,欢迎高手进来.(急!)
- 怎么要回被公司克扣的工资?进者有分
- 若选中Treeview控件的某item,再单击该项,此项便处于修改状态。我的问题是如何使该项不处于修改状态呢?
- 求和
- 如何屏蔽掉Text控件的右键快捷菜单?
- picturebox控件Height属性怎样突破最大值 ?谢谢
'注意!不要删除或修改下列被注释的行!
'MappingInfo=Image1,Image1,-1,Picture
Public Property Get P1() As Picture
Set P1 = Image1.Picture
End PropertyPublic Property Set P1(ByVal New_P1 As Picture)
Set Image1.Picture = New_P1
PropertyChanged "P1"
End Property'注意!不要删除或修改下列被注释的行!
'MappingInfo=Image2,Image2,-1,Picture
Public Property Get P2() As Picture
Set P2 = Image2.Picture
End PropertyPublic Property Set P2(ByVal New_P2 As Picture)
Set Image2.Picture = New_P2
PropertyChanged "P2"
End Property'从存贮器中加载属性值
Private Sub UserControl_ReadProperties(PropBag As PropertyBag) Set Picture = PropBag.ReadProperty("P1", Nothing)
Set Picture = PropBag.ReadProperty("P2", Nothing)
End Sub'将属性值写到存储器
Private Sub UserControl_WriteProperties(PropBag As PropertyBag) Call PropBag.WriteProperty("P1", Picture, Nothing)
Call PropBag.WriteProperty("P2", Picture, Nothing)
End Sub应该修改上面的代码如下:
'注意!不要删除或修改下列被注释的行!
'MappingInfo=Image2,Image2,-1,Picture
Public Property Get P2() As Picture
Set P2 = Image2.Picture
End PropertyPublic Property Set P2(ByVal New_P2 As Picture)
Set Image2.Picture = New_P2
PropertyChanged "P2"
End Property'从存贮器中加载属性值
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
''***注意下面两句已改
Set Image1.Picture = PropBag.ReadProperty("P1", Nothing)
Set Image2.Picture = PropBag.ReadProperty("P2", Nothing)
End Sub'将属性值写到存储器
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
''***注意下面两句已改
Call PropBag.WriteProperty("P1", Image1.Picture, Nothing)
Call PropBag.WriteProperty("P2", Image2.Picture, Nothing)
End Sub