Threads and drawing

The two things a WinForms programmer eventually has to understand: the thread that owns the window, and the surface it paints. These six lessons cover Invoke and BeginInvoke, SynchronizationContext and IProgress, async handlers and the freeze, BackgroundWorker and cancellation, OnPaint with GDI+, and a custom control with its own hit testing.

060 The UI thread, Invoke and BeginInvoke InvokeRequired, the delegate that marshals a call, ISynchronizeInvoke, the deadlock to avoid Open 061 SynchronizationContext and IProgress Post, Send, a queue that runs headless, Progress of T Open 062 Async handlers and the freeze async void, await in a handler, .Result on the UI thread, ConfigureAwait Open 063 BackgroundWorker and cancellation DoWork, ProgressChanged, RunWorkerCompleted, CancellationToken, run headless Open 064 OnPaint and GDI+ PaintEventArgs, Graphics, Pen, Brush, Invalidate, double buffering, the using rule Open 065 Custom controls and hit testing a Control and a UserControl, owner draw, the arithmetic of hit testing run headless Open

Lessons