2017-02-11 75 views
-1

在我的表單中我使用事件CustomDrawTimeCell從我的調度控制一個事件,但我需要每一分鐘,所以我想我必須使用一個Timer控制執行這種情況下,我的問題是怎麼能我從我的Timer.Tick事件中調用事件CustomDrawTimeCell呼叫從我Timer.Tick事件

編輯

這就是我需要

Private Sub Timer_Tick(sender As Object, e As EventArgs) Handles Timer.Tick 
    'Call scheduler_CustomDrawTimeCell() 
End Sub 


Private Sub scheduler_CustomDrawTimeCell(sender As Object, e As CustomDrawObjectEventArgs) Handles scheduler.CustomDrawTimeCell 
    'My code here 
End Sub 

對不起我的英語不好。

+0

你問:「如何在控制中提高事件?」或者「我如何從其他事件的包含表單中調用處理程序?」 –

+0

是CustomDrawTimeCell的一些方法嗎? –

+0

告訴我們你的代碼!簡單的描述幾乎不可能做出任何事情。 –

回答

1

可以調用處理程序像任何其他子程序...

Private Sub Timer_Tick(sender As Object, e As EventArgs) Handles Timer.Tick 
    scheduler_CustomDrawTimeCell(scheduler, New CustomDrawObjectEventArgs) 
End Sub 

如果你需要建立一個從參數對控制一些內部對象,我建議你添加一個方法來控制它強制'在你的控制

Public Sub Force_Event() 

'build your argument 
RaiseEvent CustomDrawTimeCell(me, your_Arguments) 
End Sub 

' 建立參數,並引發該事件....

表單上

Private Sub Timer_Tick(sender As Object, e As EventArgs) Handles Timer.Tick 
    scheduler.Force_Event() 
End Sub 

但是,您可能想考慮將定時器INSIDE放在控件中,而不是簡單地在那裏提高事件。

+0

謝謝你的幫助。 –

+0

感謝編輯@OneFineDay –

+0

=)不用擔心!!!!! – OneFineDay