Screen.IHandler
ReferencesHandler interface for the Screen.
Properties
BitsPerPixel
#Gets the number of bits each pixel uses to represent its color value.
Value: The screen's bits per pixel.
Bounds
#Gets the bounds of the display.
Remarks: The primary screen's upper left corner is always located at 0,0. A negative X/Y indicates that the screen location is to the left or top of the primary screen. A positive X/Y indicates that the screen location is to the right or bottom of the primary screen.
Value: The display's bounds.
Remarks: Some platforms may use this to identify controls (e.g. web)
IsPrimary
#Gets a value indicating whether this screen is the primary/main screen.
Value:
true if this is the primary screen; otherwise, false.NativeHandle
nint NativeHandle { get; }
Gets the native platform-specific handle for integration purposes
Value: The native handle.
RealScale
#Gets the real scale of the pixels of the screen vs. points.
Remarks: This should be based on a standard 72dpi screen, and is useful for retina displays when the real DPI is double the logical DPI. E.g. 1440x900 logical screen size is actually 2880x1800 pixels.
Value: The real scale of pixels per point.
Scale
#Gets the logical scale of the pixels of the screen vs. points.
Remarks: This scale should be based on a standard 72dpi screen.
Value: The logical scale of pixels per point.
WorkingArea
#Gets the working area of the display, excluding any menu/task bars, docks, etc.
Remarks: This is useful to position your window in the usable area of the screen.
Value: The working area of the screen.
Methods
GetImage
#Gets a copy of a portion of the screen as an image
Parameters:
| rect (RectangleF) | Rectangle to get the screen contents |
Returns: A new image (Icon or Bitmap) representing the specified rectangle
Remarks: Most events are late bound by this method. Instead of wiring all events, this will be called with an event string that is defined by the control. This is called automatically when attaching to events, but must be called manually when users of the control only override the event's On... method.
Initialize
void Initialize()
Called after the widget is constructed
Remarks: This gets called automatically after the control is constructed and the Widget.IHandler.Widget and Widget.Platform properties are set. When the handler has specialized construction methods, then the AutoInitializeAttribute can be used to disable automatic initialization. In this case, it is the responsibility of the subclass to call Widget.Initialize()
UnhandleEvent
Called when the last subscriber to an event has been removed, so the platform can stop listening for it.
Remarks: Only reached for events whose remove accessor uses PropertyStore.RemoveHandlerEvent(string, Delegate), and only for events that were attached because something subscribed to them. An event attached because the widget overrides its On[Event] method is never detached, since it has to keep firing regardless. Most events stay attached for the life of the widget, which costs nothing. Detaching is worth wiring up for the few that hold onto something expensive or process wide while they are attached, such as a system wide hook. Handlers deriving from WidgetHandler<TWidget> get an implementation of this that dispatches to WidgetHandler<TWidget>.DetachEvent(string), which is what to override.
Parameters:
| id (string) | ID of the event to stop handling |