Back to Devexpress

VGridControl.CustomDrawFilterPanel Event

windowsforms-devexpress-dot-xtraverticalgrid-dot-vgridcontrol-789d3954.md

latest4.1 KB
Original Source

VGridControl.CustomDrawFilterPanel Event

Enables you to paint the Filter Panel manually.

Namespace : DevExpress.XtraVerticalGrid

Assembly : DevExpress.XtraVerticalGrid.v25.2.dll

NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid

Declaration

csharp
[DXCategory("CustomDraw")]
public event CustomDrawObjectEventHandler CustomDrawFilterPanel
vb
<DXCategory("CustomDraw")>
Public Event CustomDrawFilterPanel As CustomDrawObjectEventHandler

Event Data

The CustomDrawFilterPanel event's data class is DevExpress.XtraVerticalGrid.Events.CustomDrawObjectEventArgs.

Remarks

The appearance of the filter panel can be customized via the VGridAppearanceCollection.FilterPanel object. Handle the CustomDrawFilterPanel event to get complete control over the panel’s painting. See the Custom Painting Basics and Custom Painting Scenarios topics for information on using custom draw events.

The CustomDrawFilterPanel event is raised before the filter panel is repainted. Handle this event to paint the panel manually or to paint additional elements on it. Information about the filter panel and its inner elements can be obtained using the Info parameter. To obtain the text for the filter conditions applied, use the control’s VGridControl.ActiveFilterString property.

If the panel has been custom painted, set the CustomDrawEventArgs.Handled parameter to true to prevent the default painting.

Important

Do not change cell values, modify the control’s layout, or change the control’s object model in the events used for custom control painting. Actions that update the layout can cause the control to malfunction.

Example

The following code demonstrates how to use the VGridControl.CustomDrawFilterPanel event to alter the appearance of the Vertical Grid Control’s filter panel. A 3D border is painted around the filter panel.

csharp
private void vGridControl1_CustomDrawFilterPanel(object sender, DevExpress.XtraVerticalGrid.Events.CustomDrawObjectEventArgs e) {
    Rectangle borderBounds = e.Bounds;
    borderBounds.Inflate(-1, -1);
    // Default painting.
    e.DefaultDraw();
    // 3D border.
    ControlPaint.DrawBorder3D(e.Graphics, borderBounds, Border3DStyle.Etched);
}
vb
Private Sub vGridControl1_CustomDrawFilterPanel(sender As Object, e As DevExpress.XtraVerticalGrid.Events.CustomDrawObjectEventArgs)
    Dim borderBounds As Rectangle = e.Bounds
    borderBounds.Inflate(-1, -1)
    ' Default painting.
    e.DefaultDraw()
    ' 3D border.
    ControlPaint.DrawBorder3D(e.Graphics, borderBounds, Border3DStyle.Etched)
End Sub

See Also

CustomFilterDisplayText

VGridControl Class

VGridControl Members

DevExpress.XtraVerticalGrid Namespace