当前位置 : 主页 > 编程语言 > c语言 >

VB6 ActiveX Image.picture属性

来源:互联网 收集:自由互联 发布时间:2021-06-24
我试图在VB6中创建一个带有图片属性的ActiveX OCX. picture属性设置并获取控件中图像的图片属性.我希望用户能够在设计时选择图像. 有任何想法吗? 谢谢 只需定义IPictureDisp类型的属性即可
我试图在VB6中创建一个带有图片属性的ActiveX OCX. picture属性设置并获取控件中图像的图片属性.我希望用户能够在设计时选择图像.

有任何想法吗?

谢谢

只需定义IPictureDisp类型的属性即可.

Public Property Get Picture() As IPictureDisp
  Set Picture = UserControl.Picture
End Property

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

不要忘记保存到手提包:

Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
  With PropBag
    ...
    Set Me.Picture = .ReadProperty("Picture", Nothing)
    ...
  End With
End Sub

Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
  With PropBag
    ...
    .WriteProperty "Picture", Me.Picture, Nothing
    ...
  End With
End Sub
网友评论