读书人

自制控件 事件,该如何解决

发布时间: 2012-01-19 00:22:28 作者: rapoo

自制控件 事件
如何给自制控件添加一个这样的事件,当控件的某个属性为TRUE时这个方法就开始自动的运行

[解决办法]

VB code
'以 autoredraw 为示例'缺省属性值:Const m_def_AutoRedraw = 0'属性变量:Dim m_AutoRedraw As Boolean'注意!不要删除或修改下列被注释的行!'MemberInfo=0,0,0,0Public Property Get AutoRedraw() As Boolean    AutoRedraw = m_AutoRedrawEnd PropertyPublic Property Let AutoRedraw(ByVal New_AutoRedraw As Boolean)    m_AutoRedraw = New_AutoRedraw        '************************************    If m_AutoRedraw = True Then  '加上判断语句              Call 自定义方法    End If    '**********************************        PropertyChanged "AutoRedraw"End Property'为用户控件初始化属性Private Sub UserControl_InitProperties()    m_AutoRedraw = m_def_AutoRedrawEnd Sub'从存贮器中加载属性值Private Sub UserControl_ReadProperties(PropBag As PropertyBag)    m_AutoRedraw = PropBag.ReadProperty("AutoRedraw", m_def_AutoRedraw)End Sub'将属性值写到存储器Private Sub UserControl_WriteProperties(PropBag As PropertyBag)    Call PropBag.WriteProperty("AutoRedraw", m_AutoRedraw, m_def_AutoRedraw)End Sub'**************************Private Function 自定义方法()   End Function 

读书人网 >VB

热点推荐