Context

References
public sealed class Context
Aggregates a bunch of information and functionality for drawing in graphics context. Primarily, a Context is better than a Graphics object as it provides information about the target object (either a bitmap or a control), and it allows for the animation of values and automatic invalidation of said target.

Properties

BackColour

#
public Color BackColour { get; set; }
Gets or sets the background of this context. This is not going to be correct for any given location, especially after some values have been drawn. If the value is transparent, it has not been set.

Bitmap

#
public Bitmap Bitmap { get; }
Gets the bitmap associated with this paint event, if any. This field may be null.

Control

#
public IFlexControl Control { get; }
Gets the control associated with this paint event, if any. This field may be null.

Graphics

#
public Graphics Graphics { get; }
Gets the graphics used for this paint event. This field is never null.

IconFilter

#
public Func<Color, Color> IconFilter { get; set; }
Gets the icon colour filter associated with this context.

IconPalette

#
public IconPalette IconPalette { get; set; }
Gets th icon special colour lookup palette associated with this context.

RedrawRequired

#
public bool RedrawRequired { get; }
Gets whether another redraw will be triggered as soon as this one completes. This is usually indicative of some sort of animation not having finished yet.

Zoom

#
public float Zoom { get; }
Gets the zoom of the context.

ZoomInverse

#
public float ZoomInverse { get; }
Gets the inverse of the zoom.

Methods

Animate<T>

#
public T Animate<T>(Animated<T> animated)
Evaluate an animator. This method automatically schedules redraw events if those are needed for smooth animations.
animated (Animated<T>)Animator to evaluate.
Animated value.

CreateFromBitmap

#
public static Context CreateFromBitmap(Bitmap bitmap, Graphics graphics)
Create a bitmap context.
bitmap (Bitmap)Underlying bitmap.
graphics (Graphics)Graphics object associated with bitmap.
Context.

CreateFromBitmap

#
public static Context CreateFromBitmap(Bitmap bitmap)
Create a bitmap context.
bitmap (Bitmap)Underlying bitmap, may not already be associated with a graphics object.
Context.

CreateFromContent

#
public static Context CreateFromContent(ControlGraphics graphics)
Create a content-space context.
graphics (ControlGraphics)Control graphics.
Context.

CreateFromControl

#
public static Context CreateFromControl(ControlGraphics graphics)
Create a control-space context.
graphics (ControlGraphics)Control graphics.
Context.

CreateFromGraphics

#
public static Context CreateFromGraphics(Graphics graphics, Color background)
Create a context from a disassociated graphics instance. You should use another CreateFromXXXX method if you have either the relevant control or bitmap.
graphics (Graphics)Graphics object.
background (Color)Background colour.
Context.

CreateFromScratch

#
[EditorBrowsable(EditorBrowsableState.Never)] public static Context CreateFromScratch(Graphics graphics, float zoom, IFlexControl control, Bitmap bitmap)
Create a context by setting all fields directly.
graphics (Graphics)
zoom (float)
control (IFlexControl)
bitmap (Bitmap)

Invalidate

#
public void Invalidate()
Set the RedrawRequired state to true.