gbe*_*927 4 vb6 activex properties image
我试图在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