Is it possible to create my own event in vb.net .
I need an event for Windo开发者_如何学JAVAwState = Normal.
You can use the SizeChanged
event to monitor changes to WindowState
. Then you can expose your own custom event that is raised when it changes:
Public Event WindowStateChanged As EventHandler
Private currentWindowsState As FormWindowState
Protected Overrides Sub OnSizeChanged(ByVal e As System.EventArgs)
MyBase.OnSizeChanged(e)
If WindowState <> currentWindowsState Then
currentWindowsState = WindowState
OnWindowStateChanged(EventArgs.Empty)
End If
End Sub
Protected Sub OnWindowStateChanged(ByVal e As EventArgs)
RaiseEvent WindowStateChanged(Me, e)
End Sub
This sample will raise the WindowStateChanged
event whenever it changes, regardless of from what state and to what state. You can easily add conditions to raise it only for certain states.
精彩评论