Back to Devexpress

RowCellCustomDrawEventArgs.Column Property

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

latest6.7 KB
Original Source

RowCellCustomDrawEventArgs.Column Property

Gets the column whose element is being painted.

Namespace : DevExpress.XtraGrid.Views.Base

Assembly : DevExpress.XtraGrid.v25.2.dll

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

Declaration

csharp
public GridColumn Column { get; }
vb
Public ReadOnly Property Column As GridColumn

Property Value

TypeDescription
GridColumn

A GridColumn object (or descendant) representing the column whose data cell is being painted. null ( Nothing in Visual Basic) if the painted element has no corresponding column.

|

Remarks

The property returns null ( Nothing in Visual Basic) when handling the CardView.CustomDrawCardCaption event. In other cases, the property returns the column whose data cell is being painted.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Column 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-show-error-icons/CS/Form1.cs#L59

csharp
BaseEditViewInfo info = ((GridCellInfo)e.Cell).ViewInfo;
string error = GetError(e.CellValue, e.RowHandle, e.Column);
SetError(info, error);

winforms-grid-move-cell-using-drag-drop/CS/Classes/GridViewHelper.cs#L63

csharp
if (lastMouseDownMoveCell == null || sourceGridCell == null) return;
if (e.RowHandle == lastMouseDownMoveCell.RowHandle && e.Column == lastMouseDownMoveCell.Column)
    e.Cache.DrawRectangle(e.Cache.GetPen(Color.Gray), new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height));

winforms-grid-highlight-cell-values-matching-text-in-autofilterrow/CS/CarsGridWinApp15/Main.cs#L30

csharp
string filterCellText = view.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, e.Column);
if ( String.IsNullOrEmpty(filterCellText) )

winforms-grid-richedit-highlight-search-results/CS/E4422/Form1.cs#L19

csharp
private void OnCustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) {
    if (e.Column == colDescription && !string.IsNullOrEmpty(gridView1.FindFilterText)) {
        server.RtfText = e.DisplayText;

winforms-grid-draw-thick-border-abound-focused-cell/CS/Form1.cs#L16

csharp
GridView view = sender as GridView;
if (e.Column == view.FocusedColumn && e.RowHandle == view.FocusedRowHandle) {
    e.DefaultDraw();

winforms-grid-show-error-icons/VB/Form1.vb#L67

vb
Dim info As BaseEditViewInfo = CType(e.Cell, GridCellInfo).ViewInfo
Dim [error] As String = GetError(e.CellValue, e.RowHandle, e.Column)
SetError(info, [error])

winforms-grid-move-cell-using-drag-drop/VB/Classes/GridViewHelper.vb#L60

vb
End If
If e.RowHandle = lastMouseDownMoveCell.RowHandle AndAlso e.Column Is lastMouseDownMoveCell.Column Then
    e.Cache.DrawRectangle(e.Cache.GetPen(Color.Gray), New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height))

winforms-grid-highlight-cell-values-matching-text-in-autofilterrow/VB/CarsGridWinApp15/Main.vb#L24

vb
If Not view.OptionsView.ShowAutoFilterRow OrElse Not view.IsDataRow(e.RowHandle) Then Return
Dim filterCellText As String = view.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, e.Column)
If String.IsNullOrEmpty(filterCellText) Then Return

winforms-grid-richedit-highlight-search-results/VB/E4422/Form1.vb#L22

vb
Private Sub OnCustomDrawCell(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs)
    If e.Column Is colDescription AndAlso Not String.IsNullOrEmpty(gridView1.FindFilterText) Then
        server.RtfText = e.DisplayText

winforms-grid-draw-thick-border-abound-focused-cell/VB/Form1.vb#L21

vb
Dim view As GridView = TryCast(sender, GridView)
If e.Column Is view.FocusedColumn AndAlso e.RowHandle = view.FocusedRowHandle Then
    e.DefaultDraw()

See Also

RowHandle

RowCellCustomDrawEventArgs Class

RowCellCustomDrawEventArgs Members

DevExpress.XtraGrid.Views.Base Namespace