Assume we have aready hScrollBar event method:

Pravate void hScrollBar1_Scroll(object sender, EventArgs e)
{

}

Now we would like to load it in a CheckBox event.

Normally people will do like this:

private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
this.hScrollBar1_Scroll(null, null);
}

This can work if you don’t need handle sender or e in hScrollBar1_Scroll under some conditions.

However, if you have handle sender or e in hScrollBar1_Scroll event, you can not use set the parameters of sender and e to null (this.hScrollBar1_Scroll(null, null))

The best way is the following code:

private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
this.hBarGainMax_Scroll(this.hBarGainMax, new ScrollEventArgs(ScrollEventType.EndScroll, this.hBarGainMax.Value));
}

If you just redraw a control’s interface, you can load control’ invalidate event:

private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
this.hBarGainMax_Scroll.Invalidate();
}

It is useful when you use some control to do graphic operations. But Invalidate() just redraw control, it doesn’t let hScrollBar scroll.