Back to Devexpress

ColumnHeaderCustomDrawEventArgs.Info Property

windowsforms-devexpress-dot-xtragrid-dot-views-dot-grid-dot-columnheadercustomdraweventargs-1ddf5803.md

latest6.9 KB
Original Source

ColumnHeaderCustomDrawEventArgs.Info Property

Gets an object providing information necessary to paint a column header.

Namespace : DevExpress.XtraGrid.Views.Grid

Assembly : DevExpress.XtraGrid.v25.2.dll

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

Declaration

csharp
public GridColumnInfoArgs Info { get; }
vb
Public ReadOnly Property Info As GridColumnInfoArgs

Property Value

TypeDescription
DevExpress.XtraGrid.Drawing.GridColumnInfoArgs

A DevExpress.XtraGrid.Drawing.GridColumnInfoArgs object providing appearance and state information about a column header.

|

Remarks

The returned object’s InnerElements property represents a collection of elements displayed within the painted column header (sort glyph, filter button and column header image). Each element is represented by a DevExpress.Utils.Drawing.DrawElementInfo object which enables you to obtain the element’s bounds. Elements can be recognized by the DevExpress.Utils.Drawing.DrawElementInfo.ElementPainter property type. See the GridCustomDraw demo for examples of using the InnerElements property.

The column header’s current state (normal, pressed or hot-tracked) can be obtained via the State property.

The CustomDrawObjectEventArgs.Painter object’s DrawObject method allows you to perform default element painting. This requires the Info property to be passed as the method’s parameter. You can change properties of the Info object before calling the DrawObject method. In this case, the element will be painted using new settings. Alternatively, you can change the Info object’s properties and leave the CustomDrawEventArgs.Handled property set to false. In this case, the element will also be painted using the new settings after executing the event handler.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Info property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-grid-custom-button-in-column-header/CS/WindowsApplication3/ColumnHeaderExtender.cs#L125

csharp
args.Cache = e.Cache;
args.Bounds = CalcButtonRect(e.Info, e.Cache.Graphics);
ObjectState state = ObjectState.Normal;

winforms-grid-multiple-row-selection-web-style-checkboxes/CS/E1271/CheckMarkSelection.cs#L232

csharp
e.Info.InnerElements.Clear();
e.Painter.DrawObject(e.Info);
DrawCheckBox(e.Cache, e.Bounds, SelectedCount == _view.DataRowCount);

winforms-grid-display-editors-in-columns-headers/CS/WindowsApplication1/InplaceEditorHelper/ColumnInplaceEditorHelper.cs#L61

csharp
e.Info.Caption = string.Empty;
e.Painter.DrawObject(e.Info);
e.Handled = true;

winforms-grid-add-check-box-to-column-header/CS/GridViewColumnHeaderExtender.cs#L246

csharp
{
    e.Painter.DrawObject(e.Info);
}

winforms-grid-custom-button-in-column-header/VB/WindowsApplication3/ColumnHeaderExtender.vb#L133

vb
args.Cache = e.Cache
args.Bounds = CalcButtonRect(e.Info, e.Cache.Graphics)
Dim state As ObjectState = ObjectState.Normal

winforms-grid-multiple-row-selection-web-style-checkboxes/VB/E1271/CheckMarkSelection.vb#L272

vb
e.Info.InnerElements.Clear()
e.Painter.DrawObject(e.Info)
DrawCheckBox(e.Cache, e.Bounds, SelectedCount = _view.DataRowCount)

winforms-grid-display-editors-in-columns-headers/VB/InplaceEditorHelper/ColumnInplaceEditorHelper.vb#L59

vb
e.Info.Caption = String.Empty
e.Painter.DrawObject(e.Info)
e.Handled = True

winforms-grid-add-check-box-to-column-header/VB/GridViewColumnHeaderExtender.vb#L226

vb
Private Sub DefaultDrawColumnHeader(ByVal e As ColumnHeaderCustomDrawEventArgs)
    e.Painter.DrawObject(e.Info)
End Sub

See Also

Painter

ColumnHeaderCustomDrawEventArgs Class

ColumnHeaderCustomDrawEventArgs Members

DevExpress.XtraGrid.Views.Grid Namespace