Reputation: 327
How can I call this event private void panel1_Paint(object sender, PaintEventArgs e){.....}
from like button click function or something?
I've tried panel1.Paint += new PaintEventHandler(panel1_Paint);
and couple more but they did not seem to work.
Upvotes: 0
Views: 120
Reputation: 339
You need to use it as simple function:
...your_code...; panel1_Paint(null, null); ...your_code...
Upvotes: 0
Reputation: 1054
try this:
private void Button1_Click(object sender, EventArgs e){
panel1.Invalidate();
}
the Invalidate() Method force the control to repaint.
Upvotes: 2