_VB.net_黑客防线网安服务器维护基地--Powered by WWW.RONGSEN.COM.CN

自制控件方面的有关知识

作者:黑客防线网安VB教程基地 来源:黑客防线网安VB教程基地 浏览次数:0

本篇关键词:知识有关方面控件

1.
在程序中注册和注销 OCX 控件 98-7-20
声明(在本例子里使用的是 ComCtl32.OCX如果是其他使用相应的名称):
Declare Function RegComCtl32 Lib "ComCtl32.OCX" _
Alias "DllRegisterServer" () As Long
Declare Function UnRegComCtl32 Lib "ComCtl32.OCX" _
Alias "DllUnregisterServer" () As Long
Const ERROR_SUCCESS = &H0

使用:

If RegComCtl32 = ERROR_SUCCESS Then
MsgBox "Registration Successful"
Else
MsgBox "Registration Unsuccessful"
End If

If UnRegComCtl32 = ERROR_SUCCESS Then
MsgBox "UnRegistration Successful"
Else
MsgBox "UnRegistration Unsuccessful"
End If

2.
建立可下拉选择的属性
例如在 BorderStyle 中有以下的四个选择:
0 - None
1 - Dashed
2 - Single Line
3 - Double Line
4 - 3D
首先在控件中定义以下的集合:
Enum BorderType
None
Dashed
[Single Line]
[Double Line]
[3D]
End Enum
然后就可以把属性的类型设置好:
Public Property Get BorderStyle() As BorderType
Border = m_BorderStyle
End Property

Public Property Let BorderStyle(ByVal New_BorderStyle As BorderType)
m_BorderStyle = New_BorderStyle
PropertyChanged "BorderStyle"
End Property

3.
缺省值和可选参数
VB5 加强了函数参数方面,可用以下的代码实现参数缺�

Property Get Value(Optional index As Long = 1)
...
End Property
也可使用另一个方法(慢):

Property Get Value(Optional index As Long)
If IsMissing(index) Then index = 1
...
End Property


    希望这篇自制控件方面的有关知识的文章能够对您有所帮助,如果您觉得这篇网站维护教程有用的话,别忘了推荐给您的朋友哦!如果您有好的经验方法,不妨拿出来和大家一起分享:假如每个人都拿出一个经验,那么我们都将额外的获取一堆他人的经验。
请记住本站永久域名:(黑客防线网安服务器维护方案维护基地)Www.Rongsen.Com.Cn
    黑客防线网安服务器维护方案本篇连接:http://code.rongsen.com.cn/show-14736-1.html
网站维护教程更新时间:2012-04-03 01:13:27  【打印此页】  【关闭
0
顶一下
0
踩一下
我要申请本站N点 | 黑客防线官网 |  
专业服务器维护及网站维护手工安全搭建环境,网站安全加固服务。黑客防线网安服务器维护基地招商进行中!QQ:29769479

footer  footer  footer  footer