September 7, 2002 - Overriding an Event Handler
September 7, 2002 Overriding an Event Handler Tips: September 2002
Yehuda Shiran, Ph.D.
|
OnMouseUp()
of the class System.Windows.Forms.Panel
, by adding a message that displays the coordinates of the event. You need to define a new class, say ClickPanel
, which extends the class System.Windows.Forms.Panel
. You need to:
OnMouseUp()
from the super class, System.Windows.Forms.Panel
You may want to specify that the new function is overriding the super class and is protected against further overriding by other classes that may inherit it:
override protected function OnMouseUp (e : MouseEventArgs) {
super.OnMouseUp(e);
MessageBox.Show("Mouse Up at: "+e.X+", "+ e.Y);
}
Integrating into the class ClickPanel
:
class ClickPanel extends System.Windows.Forms.Panel {
override protected function OnMouseUp (e : MouseEventArgs) {
super.OnMouseUp(e);
MessageBox.Show("Mouse Up at: "+e.X+", "+ e.Y);
}
}
To learn more about JScript .NET and ASP.NET, go to Column 117, JScript .NET, Part XI: Creating Windows Forms.