Version

DrawPhase Enumeration

Identifies the phases of an element's drawing operation
Syntax
'Declaration
 
Public Enum DrawPhase 
   Inherits System.Enum
public enum DrawPhase : System.Enum 
Members
MemberDescription
AfterDrawBackColorCalled after an element's BackColor has been drawn.
AfterDrawBordersCalled after an element's Borders have been drawn.
AfterDrawChildElementsCalled after an element's child elements have been drawn.
AfterDrawElementCalled after all drawing of the element and its children elements have been completed.
AfterDrawForegroundCalled after an element's Foreground has been drawn.
AfterDrawImageCalled after an element's foreground Image has been drawn.
AfterDrawImageBackgroundCalled after an element's ImageBackground has been drawn.
AfterDrawThemeCalled after an element has an opportunity to render itself using the system theme.
BeforeDrawBackColorCalled before an element's BackColor is drawn. Returning true from the IUIElementDrawFilter.DrawElement method on this phase will prevent default BackColor drawing.
BeforeDrawBordersCalled before an element's borders are drawn. Returning true from the IUIElementDrawFilter.DrawElement method on this phase will prevent default border drawing.
BeforeDrawChildElementsCalled before an element's child elements are drawn. Returning true from the IUIElementDrawFilter.DrawElement method on this phase will prevent default drawing operations to start for any child elements which means that the IUIElementDrawFilter.DrawElement will not be called for any of those child elements.
BeforeDrawElementCalled before an element is drawn. Returning true from the IUIElementDrawFilter.DrawElement method on this phase will prevent all default drawing for this element. It also prevents default drawing operations to start for any child elements which means that the IUIElementDrawFilter.DrawElement will not be called for any of those child elements.
BeforeDrawFocusCalled before an element's focus rect is drawn. Returning true from the IUIElementDrawFilter.DrawElement method on this phase prevents the default drawing of the focus.
BeforeDrawForegroundCalled before an element's foreground (e.g. text) is drawn. Returning true from the IUIElementDrawFilter.DrawElement method on this phase will prevent default foreground drawing.
BeforeDrawImageCalled before an element's foregroung Image is drawn. Returning true from the IUIElementDrawFilter.DrawElement method on this phase will prevent default Image drawing.
BeforeDrawImageBackgroundCalled before an element's ImageBackground is drawn. Returning true from the IUIElementDrawFilter.DrawElement method on this phase will prevent default ImageBackground drawing.
BeforeDrawThemeCalled before an element attempts to render using the system's themes. Returning true from the IUIElementDrawFilter.DrawElement on this phase will prevent the element from attempting to render using the system themes. If the element can render itself using the system themes, the main rendering phases (BackColor, ImageBackground, Borders, Image, and Foreground) will not be invoked.
NoneUsed in IUIElementDrawFilter.GetPhasesToFilter to indicate that no draw phases should be filtered.
Example

The following sample code illustrates how to modify the drawing of a row’s cell area borders for an UltraGrid control.



Imports Infragistics.Win
    Imports Infragistics.Win.UltraWinGrid

' Implement the IUIElementDrawFilter interface on a class
' (in this case the form)
Public Class Form1
    Inherits System.Windows.Forms.Form
    Implements Infragistics.Win.IUIElementDrawFilter

    Private borderPen As System.Drawing.Pen

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        ' Set the grid’s DrawFilter property to the object that
        ' implements the IUIElementDrawFilter interface.
        Me.UltraGrid1.DrawFilter = Me

        ' Create a pen to use in the filter
        Me.borderPen = New Pen(Color.DarkGoldenrod)

    End Sub

    Public Function GetPhasesToFilter(ByRef drawParams As Infragistics.Win.UIElementDrawParams) As Infragistics.Win.DrawPhase Implements Infragistics.Win.IUIElementDrawFilter.GetPhasesToFilter

        ' If the element being drawn is a RowCellAreaUIElement we're interested in
        ' drawing its borders only.
        If (TypeOf (drawParams.Element) Is RowCellAreaUIElement) Then
            Return Infragistics.Win.DrawPhase.BeforeDrawBorders
        Else
            Return Infragistics.Win.DrawPhase.None
        End If

    End Function

    Public Function DrawElement(ByVal drawPhase As Infragistics.Win.DrawPhase, ByRef drawParams As Infragistics.Win.UIElementDrawParams) As Boolean Implements Infragistics.Win.IUIElementDrawFilter.DrawElement

        ' This will only be called for the BeforeDrawBorders phase of a 
        ' RowCellAreaUIElement based on the flags returned from GetPhasesToFilter. 

        Dim elementRect As Rectangle

        ' Get the element's rect
        elementRect = drawParams.Element.Rect

        ' Draw a border along the top edge of the element.
        drawParams.Graphics.DrawLine(Me.borderPen, _
                                elementRect.Location, _
                                New Point(elementRect.Right, elementRect.Top))

        ' Return true to prevent the element from drawing its borders normally.
        Return True

    End Function
using System.Diagnostics;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;


// Implement the IUIElementDrawFilter interface on a class
// (in this case the form)
public class Form1 : 
			System.Windows.Forms.Form, 
			Infragistics.Win.IUIElementDrawFilter
{

	private System.Drawing.Pen	borderPen;   	

	private void Form1_Load(object sender, System.EventArgs e)
	{

		// Set the grid’s DrawFilter property to the object that
		// implements the IUIElementDrawFilter interface.
		this.ultraGrid1.DrawFilter = this;

		// Create a pen to use in the filter
		this.borderPen 	= new Pen(Color.DarkGoldenrod);

	}

	public Infragistics.Win.DrawPhase GetPhasesToFilter(ref Infragistics.Win.UIElementDrawParams drawParams)
	{

		// If the element being drawn is a RowCellAreaUIElement we're interested in
		// drawing its borders only.
		if (drawParams.Element is RowCellAreaUIElement)
			return Infragistics.Win.DrawPhase.BeforeDrawBorders;
		else
			return Infragistics.Win.DrawPhase.None;

	}

	public bool DrawElement(Infragistics.Win.DrawPhase drawPhase, ref Infragistics.Win.UIElementDrawParams drawParams)
	{

		// This will only be called for the BeforeDrawBorders phase of a 
		// RowCellAreaUIElement based on the flags returned from GetPhasesToFilter. 

		// Draw a border along the top edge of the element.

		Rectangle elementRect = drawParams.Element.Rect;
		 
		drawParams.Graphics.DrawLine( this.borderPen, 
										      elementRect.Location, 
										      new Point(elementRect.Right, elementRect.Top));

		// Return true to prevent the element from drawing its borders normally.
		return true;

	}
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