最新更新 sitemap 网站制作设计本站搜索
网页设计
国外网站 韩国网站 个人主页 手提袋设计 CSS 网页特效 平面设计 网站设计 Flash CMS技巧 服装网站 php教程 photoshop 画册 服务器选用 数据库 Office
虚拟主机 域名注册 云主机 网页设计 客服QQ:8208442
当前位置:首页 > 编程开发 > VB开发

VB教程:利用VB自制OCX控件

日期:09-02    来源:中国设计秀    作者:cnwebshow.com

btz中国设计秀
  Shape1.BackColor = RGB(255, 0, 0)btz中国设计秀
End Sub btz中国设计秀
btz中国设计秀
Property Get PosX() As Integer '取得CircleX的值显示给用户btz中国设计秀
  PosX = CircleXbtz中国设计秀
End Property btz中国设计秀
btz中国设计秀
Property Let PosX(ByVal New_X As Integer) '把用户写入的值设置到OCX控件内部btz中国设计秀
  If (New_X < Shape1.Width / 2) Or _btz中国设计秀
    (New_X > UserControl.ScaleWidth - Shape1.Width / 2) Thenbtz中国设计秀
    MsgBox ("圆的X值超出界限了")btz中国设计秀
  Elsebtz中国设计秀
    CircleX = New_Xbtz中国设计秀
    Call UserControl_Resizebtz中国设计秀
  End Ifbtz中国设计秀
End Property btz中国设计秀
btz中国设计秀
Property Get PosY() As Integerbtz中国设计秀
  PosY = CircleYbtz中国设计秀
End Property btz中国设计秀
btz中国设计秀
Property Let PosY(ByVal New_Y As Integer)btz中国设计秀
  If (New_Y < Shape1.Height / 2) Or _btz中国设计秀
    (New_Y > UserControl.ScaleHeight - Shape1.Height / 2) Thenbtz中国设计秀
    MsgBox ("圆的Y值超出界限了")btz中国设计秀
  Elsebtz中国设计秀
    CircleY = New_Ybtz中国设计秀
    Call UserControl_Resizebtz中国设计秀
  End Ifbtz中国设计秀
End Property btz中国设计秀
btz中国设计秀
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)btz中国设计秀
  CircleX = PropBag.ReadProperty("CircleX", Shape1.Width / 2) '将用户设置的值读出来btz中国设计秀
  CircleY = PropBag.ReadProperty("CircleY", Shape1.Height / 2) '同上btz中国设计秀
  Call UserControl_Resizebtz中国设计秀
End Sub btz中国设计秀
btz中国设计秀
Private Sub UserControl_Resize()btz中国设计秀
  Shape1.Move CircleX, CircleYbtz中国设计秀
End Sub btz中国设计秀
btz中国设计秀
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)btz中国设计秀
  Call PropBag.WriteProperty("CircleX", CircleX, Shape1.Width / 2) '将用户设置的值保存btz中国设计秀
  Call PropBag.WriteProperty("CircleY", CircleY, Shape1.Height / 2) '同上btz中国设计秀
End Sub btz中国设计秀
btz中国设计秀
  麻雀虽小,五脏俱全。这个OCX控件完成的任务虽然简单,但是OCX控件的基本操作全都有喔! 有兴趣的朋友不妨一试。btz中国设计秀

 btz中国设计秀

本文引用地址:/bc/article_61273.html
网站地图 | 关于我们 | 联系我们 | 网站建设 | 广告服务 | 版权声明 | 免责声明