ControlGraphics
ReferencesProvides several graphics states for drawing in different coordinate systems.
Constructors
ControlGraphics
#public ControlGraphics(Bitmap bitmap, RectangleF region)
Create a control graphics object based on a bitmap, showing a specific region of content. The region is scaled to fit the bitmap without distorting it, so a region whose proportions differ from the bitmap leaves margins on two sides.
Parameters:
| bitmap (Bitmap) | Bitmap. |
| region (RectangleF) | Region of content to show, in content coordinates. An empty region draws content at its own coordinates from the top left corner. |
ControlGraphics
#public ControlGraphics(Bitmap bitmap)
Create a control graphics object based on a bitmap. Content is drawn at its own coordinates, starting from the top left corner of the bitmap.
Parameters:
| bitmap (Bitmap) | Bitmap. |
ControlGraphics
#public ControlGraphics(Graphics graphics, RectangleF bounds, RectangleF region)
Create a control graphics object around a borrowed graphics, showing a specific region of content.
Parameters:
| graphics (Graphics) | Graphics to draw with. |
| bounds (RectangleF) | Bounds of the surface being drawn on. |
| region (RectangleF) | Region of content to show, in content coordinates. An empty region draws content at its own coordinates from the top left corner. |
ControlGraphics
#public ControlGraphics(Graphics graphics, RectangleF bounds)
Create a control graphics object around a graphics which belongs to somebody else, so that anything drawing through a Context can be used on a plain Eto control. The graphics is borrowed, not owned, and is left alone on disposal.
Parameters:
| graphics (Graphics) | Graphics to draw with. |
| bounds (RectangleF) | Bounds of the surface being drawn on. |
ControlGraphics
#Create a new control graphics object.
Parameters:
| control (IFlexControl) | Transformation needed to draw stuff in control coordinates. |
| graphics (Graphics) | Graphics to use. |
Properties
Content
#public Graphics Content { get; }
Gets a graphics objects which can be used to draw geometry in content coordinates. Do not cache this graphics object for prolonged periods of time.
Control
#public Graphics Control { get; }
Gets a graphics objects which can be used to draw geometry in control coordinates. Do not cache this graphics object for prolonged periods of time.
ScreenScale
#Gets or sets the screen scaling factor for the current control. This value is set automatically when these graphics are constructed, however it can be overridden by any developer who knows what they are doing.
Methods
Adjust
#Adjust a numeric value based on the relevant screen scale.
Parameters:
| value (double) | Value to adjust. |
Returns: Adjusted value.
Adjust
#Adjust a numeric value based on the relevant screen scale.
Parameters:
| value (float) | Value to adjust. |
Returns: Adjusted value.
Adjust
#Adjust an integer value based on the relevant screen scale.
Parameters:
| value (int) | Value to adjust. |
Returns: Adjusted value.
Dispose
#public void Dispose()
Dispose the internal graphics object, making sure all drawing calls are flushed.