windowsforms-devexpress-dot-xtragrid-dot-views-dot-base-dot-rowcellcustomdraweventargs-5a27e3f6.md
Gets or sets the painted element’s display text.
Namespace : DevExpress.XtraGrid.Views.Base
Assembly : DevExpress.XtraGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation
public string DisplayText { get; set; }
Public Property DisplayText As String
| Type | Description |
|---|---|
| String |
A string value representing the element’s display text.
|
Initially, the DisplayText property value contains the element’s default text representation.
If painting a data cell (via the GridView.CustomDrawCell, CardView.CustomDrawCardFieldValue and LayoutView.CustomDrawCardFieldValue events), the DisplayText property returns the cell’s display text formatted as specified by the column’s GridColumn.DisplayFormat property.
If painting a card field (via the CardView.CustomDrawCardField event) and card field caption (via the CardView.CustomDrawCardFieldCaption and LayoutView.CustomDrawCardFieldCaption events), the DisplayText property initially contains the card field caption.
The DisplayText property can be used in two ways:
The following code snippets (auto-collected from DevExpress Examples) contain references to the DisplayText 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-richedit-highlight-search-results/CS/E4422/Form1.cs#L20
if (e.Column == colDescription && !string.IsNullOrEmpty(gridView1.FindFilterText)) {
server.RtfText = e.DisplayText;
Document document = server.Document;
winforms-grid-highlight-cell-values-matching-text-in-autofilterrow/CS/CarsGridWinApp15/Main.cs#L38
e.Appearance.FillRectangle(e.Cache, e.Bounds);
e.Cache.Paint.DrawMultiColorString(e.Cache, e.Bounds, e.DisplayText, filterCellText, e.Appearance, Color.Black, Color.Gold, false, filterTextIndex);
e.Handled = true;
winforms-grid-show-editor-buttons-on-cell-hover/CS/WindowsApplication3/Form1.cs#L48
info.EditorButtonPainter.DrawObject(args);
e.Cache.DrawString(e.DisplayText, e.Appearance.Font, e.Appearance.GetForeBrush(e.Cache), textRect, e.Appearance.GetStringFormat());
e.Handled = true;
winforms-diagram-create-custom-toolbox/CS/CustomDiagramToolboxExample/Form1.cs#L42
{
e.Appearance.DrawString(e.Cache, e.DisplayText, new Rectangle(e.Bounds.X + shapeTextOffset, e.Bounds.Y, e.Bounds.Width - shapeTextOffset, e.Bounds.Height));
e.Cache.TranslateTransform(e.Bounds.X, e.Bounds.Y);
winforms-grid-display-icons-in-data-cells/CS/Form1.cs#L244
if (e.RowHandle != GridControl.NewItemRowHandle && e.Column.FieldName == "CustomDraw") {
e.DisplayText = string.Empty;
e.DefaultDraw();
winforms-grid-richedit-highlight-search-results/VB/E4422/Form1.vb#L23
If e.Column Is colDescription AndAlso Not String.IsNullOrEmpty(gridView1.FindFilterText) Then
server.RtfText = e.DisplayText
Dim document As Document = server.Document
winforms-grid-highlight-cell-values-matching-text-in-autofilterrow/VB/CarsGridWinApp15/Main.vb#L29
e.Appearance.FillRectangle(e.Cache, e.Bounds)
e.Cache.Paint.DrawMultiColorString(e.Cache, e.Bounds, e.DisplayText, filterCellText, e.Appearance, Color.Black, Color.Gold, False, filterTextIndex)
e.Handled = True
winforms-grid-show-editor-buttons-on-cell-hover/VB/WindowsApplication3/Form1.vb#L51
info.EditorButtonPainter.DrawObject(args)
e.Cache.DrawString(e.DisplayText, e.Appearance.Font, e.Appearance.GetForeBrush(e.Cache), textRect, e.Appearance.GetStringFormat())
e.Handled = True
winforms-diagram-create-custom-toolbox/VB/CustomDiagramToolboxExample/Form1.vb#L43
Try
e.Appearance.DrawString(e.Cache, e.DisplayText, New System.Drawing.Rectangle(e.Bounds.X + Me.shapeTextOffset, e.Bounds.Y, e.Bounds.Width - Me.shapeTextOffset, e.Bounds.Height))
e.Cache.TranslateTransform(e.Bounds.X, e.Bounds.Y)
winforms-grid-display-icons-in-data-cells/VB/Form1.vb#L216
If e.RowHandle <> GridControl.NewItemRowHandle AndAlso Equals(e.Column.FieldName, "CustomDraw") Then
e.DisplayText = String.Empty
e.DefaultDraw()
See Also
RowCellCustomDrawEventArgs Class