怎么将图片Image 显示在ActiveX上

jiang_hlbt 2009-01-12 02:02:50
我想做个ActiveX,其中显示一个图片,但不知道怎么做!!
下面是我做的,运行不了!!
希望谁能指点一下,谢谢大家了!!!

Public Property Get picture() As Variant
picture=Image1.Picture
End Property

Public Property Let picture(ByVal vNewValue As Variant)
Image1.Picture = vNewValue
PropertyChanged "picture"
End Property

Private 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
...全文
53 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Tiger_Zhao 2009-02-02
  • 打赏
  • 举报
回复
Public Property Get Picture() As IPictureDisp
Set Picture = Image1.Picture
End Property

Public Property Set Picture(ByVal RHS As IPictureDisp)
Set Image1.Picture = RHS
PropertyChanged "Picture"
End Property

Private 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
东方之珠 2009-02-02
  • 打赏
  • 举报
回复
去看MSDN自带的例子
mfkinfo 2009-01-13
  • 打赏
  • 举报
回复
如果是把imagebox控件中ActiveX控件的一部分:
picture设为对象属性或picture,用接口向导生成后,在UserControl_ReadPropertie事件中添加:
Set Image1.Picture = PropBag.ReadProperty("Picture", Nothing)
如果是想在工具栏内改变ActiveX控件的显示方式:
修改用户控件的ToolboxBitmap属性即可。

1,451

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧