Back to Devexpress

CustomDrawObjectEventArgs.Info Property

windowsforms-devexpress-dot-xtragrid-dot-views-dot-base-dot-customdrawobjecteventargs.md

latest7.3 KB
Original Source

CustomDrawObjectEventArgs.Info Property

Gets an object containing information about the painted element.

Namespace : DevExpress.XtraGrid.Views.Base

Assembly : DevExpress.XtraGrid.v25.2.dll

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

Declaration

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

Property Value

TypeDescription
DevExpress.Utils.Drawing.ObjectInfoArgs

A DevExpress.Utils.Drawing.ObjectInfoArgs object providing information about the painted element.

|

Remarks

The Info property can be used to:

  • obtain the painted element’s settings and custom paint based on these settings;
  • pass the Info property’s value to the DrawObject method of the object returned by the CustomDrawObjectEventArgs.Painter property. This will paint the element using the default mechanism. Thus, a default appearance can be provided for the painted elements and additional painting performed in them only when required. For example, a check sign could be painted within the focused column’s header;
  • change the Info property’s settings. In this instance, the CustomDrawEventArgs.Handled property can be left set to false thus forcing default painting but with the modified settings.

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-keep-groups-expanded/CS/KeepGroupsExpanded/Form1.cs#L26

csharp
DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupRowInfo info;
info = e.Info as DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupRowInfo;
info.ButtonBounds = Rectangle.Empty;

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

csharp
void View_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e) {
    GridGroupRowInfo info = e.Info as GridGroupRowInfo;
    info.GroupText = " " + info.GroupText.TrimStart();

winforms-grid-enable-editing-in-group-row-to-change-cell-values/CS/WindowsApplication3/GroupEditProvider.cs#L217

csharp
e.Appearance.FillRectangle(e.Cache, e.Bounds);
    e.Painter.DrawObject(e.Info);
}

winforms-grid-conditionally-hide-summaries-from-group-rows/CS/ConditionallyHideSumsInGroupRows/Form1.cs#L31

csharp
private void gridView1_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e) {
    GridGroupRowInfo info = (GridGroupRowInfo)e.Info;
    if(info.Column.FieldName == "Discontinued") {

winforms-grid-display-custom-rows/CS/CustomRowInGrid/CustomRowInGrid/Form1.cs#L112

csharp
{
    GridGroupRowInfo info = e.Info as GridGroupRowInfo;
    info.GroupText = "Custom Rows";

winforms-grid-keep-groups-expanded/VB/KeepGroupsExpanded/Form1.vb#L28

vb
Dim info As DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupRowInfo
info = TryCast(e.Info, DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupRowInfo)
info.ButtonBounds = Rectangle.Empty

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

vb
Private Sub View_CustomDrawGroupRow(ByVal sender As Object, ByVal e As RowObjectCustomDrawEventArgs)
    Dim info As GridGroupRowInfo = TryCast(e.Info, GridGroupRowInfo)
    info.GroupText = " " & info.GroupText.TrimStart()

winforms-grid-enable-editing-in-group-row-to-change-cell-values/VB/WindowsApplication3/GroupEditProvider.vb#L205

vb
e.Appearance.FillRectangle(e.Cache, e.Bounds)
    e.Painter.DrawObject(e.Info)
End Sub

winforms-grid-conditionally-hide-summaries-from-group-rows/VB/ConditionallyHideSumsInGroupRows/Form1.vb#L32

vb
Private Sub gridView1_CustomDrawGroupRow(ByVal sender As Object, ByVal e As Views.Base.RowObjectCustomDrawEventArgs)
    Dim info As GridGroupRowInfo = CType(e.Info, GridGroupRowInfo)
    If Equals(info.Column.FieldName, "Discontinued") Then

winforms-grid-display-custom-rows/VB/CustomRowInGrid/Form1.vb#L114

vb
If dsw.IsCustomItemIndex(index) Then
    Dim info As GridGroupRowInfo = TryCast(e.Info, GridGroupRowInfo)
    info.GroupText = "Custom Rows"

See Also

Painter

Handled

CustomDrawObjectEventArgs Class

CustomDrawObjectEventArgs Members

DevExpress.XtraGrid.Views.Base Namespace