Screen Refresh Event

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is an event fired whenever there's a screen refresh? I'm wanting to run a
certain method whenever there's a screen refresh and was wondering if I could
override wndproc and listen for an event to do it.

Any ideas?

Darrell
 
On screen refresh the Paint event is fired.

I thought so but when I do...

protected override void OnPaint(PaintEventArgs e)
{
MessageBox.Show("Refreshed...");
}

....on the main form the "Refreshed..." message box only gets output once.

Darrell
 
Hi Darrel,

That is because there is only one Paint event triggered when you start the
program. Try minimizing your form, then restore it, or cover your form
with some other window (for instance the MessageBox), and uncover it. You
can also trigger a Paint event by calling Refresh() or Invalidate().

The Paint event is only triggered when Windows detects your Form needs to
be repainted (uncovered or restored) or you trigger it on your own.
 
Back
Top