Properties
Remarks: Some platforms may use this to identify controls (e.g. web)
NativeHandle
nint NativeHandle { get; }
Gets the native platform-specific handle for integration purposes
Value: The native handle.
Methods
Clone
#Creates a clone of the bitmap
Parameters:
| rectangle (Rectangle? = null) | If specified, the region of the bitmap to clone |
Create
#Create a new scaled bitmap with the specified
width and heightParameters:
| image (Image) | Image to scale |
| width (int) | Width to scale the source image to |
| height (int) | Height to scale the source image to |
| interpolation (ImageInterpolation) | Interpolation quality |
Create
#Creates a new bitmap optimized for drawing on the specified
graphicsCreate
#Creates a new bitmap in-memory with the specified format
Parameters:
| width (int) | Initial width of the bitmap |
| height (int) | Initial height of the bitmap |
| pixelFormat (PixelFormat) | Format of each of the pixels in the bitmap |
Create
#Create a bitmap from a specified stream
Parameters:
| stream (Stream) | Stream to load from the bitmap |
GetPixel
#Gets the color of the pixel at the specified coordinates
Returns: The color of the pixel at the specified coordinates
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()
Remarks: This locks the data to read and write to directly using unsafe pointers. After reading or updating the data, you must call ILockableImage.Unlock(BitmapData) to unlock the data.
Returns: A BitmapData object with information about the locked data
Save
#Saves the bitmap to a stream in the specified format
Parameters:
| stream (Stream) | Stream to save the bitmap to |
| format (ImageFormat) | Format to save as |
Save
#Saves the bitmap to a file in the specified format
Parameters:
| fileName (string) | File to save the bitmap to |
| format (ImageFormat) | Format to save as |
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 |
Remarks: This will unlock the data, and in some platforms write the data back to the image. You must call this method before using the bitmap again.
Parameters:
| bitmapData (BitmapData) | The data previously locked via the ILockableImage.Lock() method |