Infragistics(R) NetAdvantage(R) Windows Forms
DrawTheme Method
See Also  Example E-mail your feedback on this topic.
Infragistics.Win Namespace > UIElement Class : DrawTheme Method

drawParams
The UIElementDrawParams used to provide rendering information.
Used by an element to render using the system theme. This method will not be invoked if the themes are not supported.

Syntax

Visual Basic (Declaration) 
Protected Overridable Function DrawTheme( _
   ByRef drawParams As UIElementDrawParams _
) As Boolean
C# 
protected virtual bool DrawTheme( 
   ref UIElementDrawParams drawParams
)

Parameters

drawParams
The UIElementDrawParams used to provide rendering information.

Return Value

Returning true will prevent the invocation of the DrawBackColor, DrawImageBackground, DrawBorders, DrawImage and DrawForeground. Return false when themes are not supported by the element or if unable to render using the system theme.

Example

To add XP theming support to your element. Simply override the virtual method DrawTheme. Use the XPThemes class to render the system based theme element.

Visual BasicCopy Code
Imports Infragistics.Win

Protected Overrides Function DrawTheme(ByRef drawParams As Infragistics.Win.UIElementDrawParams) As Boolean
     
       Return XPThemes.Button.DrawPushButton( _
        drawParams, _
        Me.Rect, _
        drawParams.InvalidRect, _
        UIElementButtonState.Inactive, False)

   End Function
C#Copy Code
using Infragistics.Win;

protected override bool DrawTheme( ref UIElementDrawParams drawParams )
{

	return XPThemes.Button.DrawPushButton(ref drawParams, 
										     this.Rect, 
										     drawParams.InvalidRect, 
										     UIElementButtonState.Inactive,false);

}

See Also