Click here to Skip to main content
15,867,141 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Reading unicode text file in FCL Pin
Mike Dimmick18-Apr-05 22:54
Mike Dimmick18-Apr-05 22:54 
GeneralRe: Reading unicode text file in FCL Pin
NOTEPAK19-Apr-05 8:45
NOTEPAK19-Apr-05 8:45 
GeneralCookies and winform Pin
Anonymous16-Apr-05 2:52
Anonymous16-Apr-05 2:52 
GeneralRe: Cookies and winform Pin
Steven Campbell19-Apr-05 6:49
Steven Campbell19-Apr-05 6:49 
GeneralEvent Queuing Question Pin
paulsawyer16-Apr-05 2:27
paulsawyer16-Apr-05 2:27 
GeneralRe: Event Queuing Question Pin
Mike Dimmick18-Apr-05 22:58
Mike Dimmick18-Apr-05 22:58 
GeneralRe: Event Queuing Question Pin
paulsawyer19-Apr-05 7:11
paulsawyer19-Apr-05 7:11 
GeneralRe: Event Queuing Question Pin
Mike Dimmick19-Apr-05 8:12
Mike Dimmick19-Apr-05 8:12 
The OnPaint override is called when Windows generates a WM_PAINT message for the window (control or form). This occurs when the thread's message queue is otherwise idle (except for timer messages), and there is an invalid region - an area that Windows considers is not up to date.

Parts of the window become invalidated either automatically, as parts of the window that were obscured are revealed (or the window is shown when previously hidden), or explicitly, by calling the Invalidate method. A common way to handle the requirement to update the UI for a control is simply to invalidate the rectangle or region that needs to be updated and allow Windows to generate WM_PAINT when idle.

Another case when painting occurs is when Control.Update is called. In this case OnPaint is called directly [actually indirectly via the window procedure] - Control.Update does not return until OnPaint does.

In the main, though, two conditions are required for OnPaint to be called: an area of the window is invalid, and a message loop is executing.

Modal dialogs have a modal message loop - the code loops, pumping messages, until the dialog is closed. This won't in itself cause the parent form's OnPaint to be called unless an area is invalidated by obscuring and revealing that area.

If you're debugging on the same machine, you may find that the debugger is obscuring the form - when you hit a breakpoint it causes the form to be invalidated; when you run it is revealed so OnPaint is called. You can avoid this by using a smaller debugger window, by putting the debuggee on a separate monitor from the debugger, or by using remote debugging.

Stability. What an interesting concept. -- Chris Maunder
GeneralRe: Event Queuing Question Pin
Dave Kreskowiak19-Apr-05 8:14
mveDave Kreskowiak19-Apr-05 8:14 
GeneralRe: Event Queuing Question Pin
paulsawyer20-Apr-05 5:19
paulsawyer20-Apr-05 5:19 
GeneralRe: Event Queuing Question Pin
Dave Kreskowiak20-Apr-05 17:16
mveDave Kreskowiak20-Apr-05 17:16 
GeneralRe: Event Queuing Question Pin
paulsawyer21-Apr-05 7:11
paulsawyer21-Apr-05 7:11 
Generaldraw text in .NET Framework control Pin
Anonymous15-Apr-05 23:45
Anonymous15-Apr-05 23:45 
GeneralRe: draw text in .NET Framework control Pin
MoustafaS16-Apr-05 11:49
MoustafaS16-Apr-05 11:49 
GeneralRe: draw text in .NET Framework control Pin
Anonymous17-Apr-05 20:31
Anonymous17-Apr-05 20:31 
GeneralRe: draw text in .NET Framework control Pin
MoustafaS18-Apr-05 12:27
MoustafaS18-Apr-05 12:27 
GeneralFinally here!! Pin
Johnathon Dupuis15-Apr-05 16:41
Johnathon Dupuis15-Apr-05 16:41 
GeneralUnmanaged dll in Pocket PC 2002. Pin
Anonymous15-Apr-05 5:51
Anonymous15-Apr-05 5:51 
GeneralRe: Unmanaged dll in Pocket PC 2002. Pin
Mike Dimmick15-Apr-05 8:11
Mike Dimmick15-Apr-05 8:11 
GeneralInstalled fonts in .NET Compact Framework Pin
Anonymous15-Apr-05 5:46
Anonymous15-Apr-05 5:46 
GeneralRe: Installed fonts in .NET Compact Framework Pin
Mike Dimmick15-Apr-05 8:29
Mike Dimmick15-Apr-05 8:29 
GeneralMicrosoft Reporting Service Pin
sukasukabo15-Apr-05 1:49
sukasukabo15-Apr-05 1:49 
GeneralRe: Microsoft Reporting Service Pin
Anonymous17-Apr-05 18:16
Anonymous17-Apr-05 18:16 
General.NET dependencies Pin
Anonymous15-Apr-05 0:38
Anonymous15-Apr-05 0:38 
GeneralRe: .NET dependencies Pin
Sebastian Schneider15-Apr-05 3:42
Sebastian Schneider15-Apr-05 3:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.