event eventhandler c# example
Example 1: how to create event in c#
class Counter
{
public event EventHandler ThresholdReached;
protected virtual void OnThresholdReached(EventArgs e)
{
EventHandler handler = ThresholdReached;
handler?.Invoke(this, e);
}
}
Example 2: c# event
private void panel1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
}
private void panel1_MouseEnter(object sender, System.EventArgs e)
private void panel1_MouseHover(object sender, System.EventArgs e)
private void panel1_MouseLeave(object sender, System.EventArgs e)
private void panel1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
private void panel1_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
private void panel1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
private void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
private void clearButton_Click(object sender, System.EventArgs e)
0