我想做个ActiveX,其中显示一个图片,但不知道怎么做!!
下面是我做的,运行不了!!
希望谁能指点一下,谢谢大家了!!!Public Property Get picture() As Variant
    picture=Image1.Picture
End PropertyPublic Property Let picture(ByVal vNewValue As Variant)
    Image1.Picture = vNewValue
    PropertyChanged "picture"
End PropertyPrivate Sub UserControl_ReadProperties(PropBag As PropertyBag)
    Image1.Picture = PropBag.ReadProperty("picture", "")
End Sub 
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
    Call PropBag.WriteProperty("picture", Image1.Picture, "")
End Sub

解决方案 »

  1.   

    如果是把imagebox控件中ActiveX控件的一部分:
    picture设为对象属性或picture,用接口向导生成后,在UserControl_ReadPropertie事件中添加:
    Set Image1.Picture = PropBag.ReadProperty("Picture", Nothing)
    如果是想在工具栏内改变ActiveX控件的显示方式:
    修改用户控件的ToolboxBitmap属性即可。
      

  2.   

    Public Property Get Picture() As IPictureDisp
        Set Picture = Image1.Picture
    End PropertyPublic Property Set Picture(ByVal RHS As IPictureDisp)
        Set Image1.Picture = RHS
        PropertyChanged "Picture"
    End PropertyPrivate Sub UserControl_ReadProperties(PropBag As PropertyBag)
        Set Image1.Picture = PropBag.ReadProperty("Picture", Nothing)
    End Sub
     
    Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
        Call PropBag.WriteProperty("Picture", Image1.Picture, Nothing)
    End Sub