Context
ReferencesAggregates 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
#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.
public Color BackColour { get; set; }
Bitmap
#Gets the bitmap associated with this paint event, if any. This field may be null.
public Bitmap Bitmap { get; }
Graphics
#Gets the graphics used for this paint event. This field is never null.
public Graphics Graphics { get; }
RedrawRequired
#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.
Methods
Animate<T>
#Evaluate an animator. This method automatically schedules redraw events if those are needed for smooth animations.
Returns: Animated value.
CreateFromBitmap
#Create a bitmap context.
public static Context CreateFromBitmap()
Bitmap
bitmap,
Underlying bitmap.
Graphics
graphics
Graphics object associated with bitmap.
Returns: Context.
CreateFromBitmap
#Create a bitmap context.
public static Context CreateFromBitmap()
Bitmap
bitmap
Underlying bitmap, may not already be associated with a graphics object.
Returns: Context.
CreateFromGraphics
#Create a context from a disassociated graphics instance. You should use another CreateFromXXXX method if you have either the relevant control or bitmap.
public static Context CreateFromGraphics()
Graphics
graphics,
Graphics object.
Color
background
Background colour.
Returns: Context.
CreateFromScratch
#Create a context by setting all fields directly.