WinForms
Classic Windows desktop applications.
WinForms is taught here in 14 lessons, running from Forms and controls through to Migrating from WinForms to WPF, WinUI or Blazor Hybrid. Each lesson takes one topic, shows the working code, and links onward to the next, so the course can be read straight through in order.
| Track | .NET |
| Lessons | 14 |
| Level | Beginner to intermediate |
| Reading time | about 3 hours |
| Prerequisites | Helpful, but not required: LINQ |
Lessons
- Forms and controlsHow a WinForms application starts, the controls you will reach for first, and the designer files that are generated for you.
- Events and layoutWiring handlers, the Dock and Anchor rules that keep a resizable form sane, and updating the UI from a worker thread.
- Data binding and when not to use WinFormsBindingSource, BindingList and DataGridView, plus the honest reasons to choose a different UI stack for a new project.
- Menus, toolbars and status barsBuild the standard desktop chrome: a MenuStrip with shortcuts, context menus, a ToolStrip with dropdowns, and a StatusStrip that reports state without stealing focus.
- Dialogs, multiple forms and MDIShow versus ShowDialog, ownership and results, passing data between forms without global state, and the MDI pattern that still appears in line-of-business tools.
- Validation and user input handlingValidating and Validated events, ErrorProvider, masked and numeric input, and how to keep a dialog open when the data is wrong.
- DataGridView in depthColumn types and formatting, sorting and filtering, master-detail layouts, virtual mode for large data, and cell-level validation and errors.
- Custom controls and owner-drawn renderingDerive from UserControl or Control, expose properties and events properly, override OnPaint, and take over drawing for list and tree controls.
- Drawing, images and printing with GDI+Graphics, Pen and Brush basics, drawing to a control versus a bitmap, DPI-aware scaling, and printing through PrintDocument with a preview.
- Async work, threading and progressasync and await inside event handlers, Task.Run for CPU-bound work, progress reporting and cancellation, and the cross-thread exception that comes from touching a control from the wrong thread.
- Files, settings and persistenceOpenFileDialog and SaveFileDialog, JSON configuration, user settings, recent-file lists, and the file-handling rules that keep a desktop app trustworthy.
- High DPI, accessibility and themingPer-monitor DPI awareness, autoscaling pitfalls, screen reader names and tab order, keyboard-only operation, and the honest state of dark mode in WinForms.
- Deployment: ClickOnce, MSIX and single-fileClickOnce updates, MSIX packaging and signing, single-file and self-contained publishing, and how to pick the channel that fits the users you support.
- Migrating from WinForms to WPF, WinUI or Blazor HybridInventory a legacy codebase, separate business logic from UI, migrate incrementally with interop, and compare the replacement stacks honestly.
More in .NET
FAQ
How long does the WinForms course take?
It has 14 lessons, about 3 hours of reading. Expect roughly twice that if you type out and run every example.
Do I need prior experience for WinForms?
Not strictly. It helps to have read LINQ first, because some lessons build on it, but every lesson explains its own assumptions.
What should I read after WinForms?
Continue with WPF (14 lessons), the next course in .NET.