Paint Event
Hi all,
I have a function DisplayIt() to draw something and use the Paint event or DisplayPanel_Paint() to call and display it.
However my Display() function is called at least 2 or more times.
- Why is that? and how do i prevent it?
private void DisplayPanel_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
DisplayIt();
}
Many thanks
Trevor
Mahesh ChandPosted Sep 6, 2005, 9:50 AM
Form's paint event is raised every time when the form needs to render the pixels and there can be many
reasons for the same such as resizing, refrshing, load and etc. You might want to check if you are
doing any thing like that. If you want code on paint event not to be executed after first time, you can
set a flag and check if before the code.