ControlGraphics

References
Provides 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.
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.
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.
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.
graphics (Graphics)Graphics to draw with.
bounds (RectangleF)Bounds of the surface being drawn on.

ControlGraphics

#
public ControlGraphics(IFlexControl control, Graphics graphics)
Create a new control graphics object.
control (IFlexControl)Transformation needed to draw stuff in control coordinates.
graphics (Graphics)Graphics to use.

Properties

AssociatedControl

#
public IFlexControl AssociatedControl { get; }
Gets the control associated with this graphics object.

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.

ContentContext

#
public Context ContentContext { get; }
Gets the graphics context for the content space.

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.

ControlContext

#
public Context ControlContext { get; }
Gets the graphics context for the control space.

IsDisposed

#
public bool IsDisposed { get; }
Gets whether these graphics have been disposed.

ScreenScale

#
public float ScreenScale { get; set; }
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.

Zoom

#
public float Zoom { get; }
Gets the zoom factor used for the content.

Methods

Adjust

#
public double Adjust(double value)
Adjust a numeric value based on the relevant screen scale.
value (double)Value to adjust.
Adjusted value.

Adjust

#
public float Adjust(float value)
Adjust a numeric value based on the relevant screen scale.
value (float)Value to adjust.
Adjusted value.

Adjust

#
public int Adjust(int value)
Adjust an integer value based on the relevant screen scale.
value (int)Value to adjust.
Adjusted value.

Dispose

#
public void Dispose()
Dispose the internal graphics object, making sure all drawing calls are flushed.

ProjectionState

#
public IDisposable ProjectionState()
Gets a disposable object which stores the current projection state. Get and dispose this object if you intend to switch from Control to Content or vice versa in the middle of another drawing routine.

ResetScreenScale

#
public void ResetScreenScale()
Reset the screenscale factor to the system value.