ControlGraphics

References
Provides several graphics states for drawing in different coordinate systems.

Constructors

ControlGraphics

#
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.
public ControlGraphics(
Bitmap
bitmap,
Bitmap.
RectangleF
region
Region of content to show, in content coordinates. An empty region draws content at its own coordinates from the top left corner.
)

ControlGraphics

#
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.
public ControlGraphics(
Bitmap
bitmap
Bitmap.
)

ControlGraphics

#
Create a control graphics object around a borrowed graphics, showing a specific region of content.
public ControlGraphics(
Graphics
graphics,
Graphics to draw with.
RectangleF
bounds,
Bounds of the surface being drawn on.
RectangleF
region
Region of content to show, in content coordinates. An empty region draws content at its own coordinates from the top left corner.
)

ControlGraphics

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

ControlGraphics

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

Properties

AssociatedControl

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

Content

#
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.
public Graphics Content { get; }

ContentContext

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

Control

#
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.
public Graphics Control { get; }

ControlContext

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

IsDisposed

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

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

Zoom

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

Methods

Adjust

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

Adjust

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

Adjust

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

Dispose

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

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.
public IDisposable ProjectionState()

ResetScreenScale

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