Events

Everything a user does arrives as an event, and the handlers are ordinary C# delegates. These seven lessons start from the delegate and go through the events a form actually uses: the click and the order of the mouse events around it, the keyboard, the mouse, validation, drag and drop with the clipboard, and the unsubscribe that keeps a handler from keeping a form alive. The event itself is plain .NET code, so the lessons that can run their logic do run it.

030 Delegates and EventHandler a custom event, EventHandler and EventHandler of T, subscribe, unsubscribe, multicast order, run headless Open 031 Click and the order of mouse events MouseDown, MouseUp, Click, DoubleClick, the order a control raises them Open 032 Key events KeyDown, KeyPress, KeyUp, Keys, SuppressKeyPress, KeyPreview, a key filter that runs headless Open 033 Mouse events MouseButtons, e.Location, Capture, MouseMove and the arithmetic of a selection rectangle, run headless Open 034 Validating and Validated CancelEventArgs, CausesValidation, a validator class and a presenter that run headless Open 035 Drag and drop, and the clipboard DoDragDrop, DragEnter, DragDrop, DataObject, DataFormats, Clipboard Open 036 Unsubscribing and leaks what keeps a form alive, the missing -=, WeakReference and a counter that runs headless Open

Lessons