Framework
The framework half of the CustomControls package — the interfaces, callback objects, and drawing primitives an author of a custom control writes against. The eight concrete Waynes… controls in the package are themselves built on this surface; the same pieces are available to user code that needs to implement an entirely new custom control.
A custom control:
- Implements ICustomControl (or ICustomForm for a form-class custom control).
- Stores the CustomControlContext handed to it on Initialize and uses it to request repaints, create timers, or change the focused element.
- Inside Paint, builds one or more
ElementDescriptorrecords and hands them to the Canvas via RuntimeUICCCanvasAddElement — the framework rasterises them, handles input routing, and dispatches events back through the descriptor’sAddressOf-registered callbacks.
Class MyControl
Implements CustomControls.ICustomControl
Private Context As CustomControls.CustomControlContext
Private Sub OnInitialize(ByVal Ctx As CustomControls.CustomControlContext) _
Implements CustomControls.ICustomControl.Initialize
Set Me.Context = Ctx
End Sub
Private Sub OnDestroy() _
Implements CustomControls.ICustomControl.Destroy
End Sub
Private Sub OnPaint(ByVal Canvas As CustomControls.Canvas) _
Implements CustomControls.ICustomControl.Paint
' build ElementDescriptor records and call Canvas.RuntimeUICCCanvasAddElement
End Sub
End Class
Interfaces
- ICustomControl – the interface implemented by every concrete custom control: Initialize, Destroy, Paint
- ICustomForm – the analogous interface for custom form classes
Callback objects
- CustomControlContext – the callback object passed to Initialize; GetSerializer, Repaint, CreateTimer, ChangeFocusedElement
- CustomFormContext – a CustomControlContext extended with Show and Close, passed to a custom form’s Initialize
- CustomControlTimer – the timer returned by CustomControlContext.CreateTimer; Interval, Enabled, OnTimer event
- CustomControlsCollection – the Controls collection on a WaynesForm or any other custom form
Drawing primitives
- Canvas – the drawing surface passed to Paint; RuntimeUICCCanvasAddElement, plus size and DPI accessors
- SerializeInfo – the per-instance serializer reached via CustomControlContext.GetSerializer; RuntimeUISrzDeserialize, design-mode flags, owner handle, runtime mode