Version

DrawForeground Method (DisplayCharUIElement)

overridden method for drawing the char
Syntax
'Declaration
 
Protected Overrides Sub DrawForeground( _
   ByRef drawParams As UIElementDrawParams _
) 
protected override void DrawForeground( 
   ref UIElementDrawParams drawParams
)

Parameters

drawParams
The Infragistics.Win.UIElementDrawParams used to provide rendering information.
Example
This sample overrides the virtual method DrawForeground of UIElement. Here we are filling the control Rect with the System.ControlLight color, and outlining it using ControlDark.

Imports Infragistics.Win

Protected Overrides Sub DrawForeground(ByRef drawParams As UIElementDrawParams)
       
       ' We are going to draw the foreground ControlLight
       ' with a ControlDark border.
       Dim Brush As SolidBrush = New SolidBrush(SystemColors.ControlLight)

       Dim colorRect As Rectangle = Me.Rect

       colorRect.Inflate(-3, -3)
       drawParams.Graphics.FillRectangle(Brush, colorRect)

       colorRect.Width -= 1
       colorRect.Height -= 1

       drawParams.Graphics.DrawRectangle(SystemPens.ControlDark, colorRect)

       Brush.Dispose()

End Sub
using Infragistics.Win;

protected override void DrawForeground(ref UIElementDrawParams drawParams)
{

	// We are going to draw the foreground ControlLight
	// with a ControlDark border.
	SolidBrush brush = new SolidBrush(SystemColors.ControlLight );

	Rectangle colorRect = this.Rect;

	colorRect.Inflate(-3,-3);
	drawParams.Graphics.FillRectangle(brush,colorRect);

	colorRect.Width--;
	colorRect.Height--;

	drawParams.Graphics.DrawRectangle(SystemPens.ControlDark,colorRect);

	brush.Dispose();

}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also