Back to Devexpress

AppearanceObject.FillRectangle(GraphicsCache, Rectangle) Method

windowsforms-devexpress-dot-utils-dot-appearanceobject-dot-fillrectangle-x28-devexpress-dot-utils-dot-drawing-dot-graphicscache-system-dot-drawing-dot-rectangle-x29.md

latest7.3 KB
Original Source

AppearanceObject.FillRectangle(GraphicsCache, Rectangle) Method

Fills the interior of a rectangle specified by a Rectangle structure.

Namespace : DevExpress.Utils

Assembly : DevExpress.Utils.v25.2.dll

NuGet Packages : DevExpress.Utils, DevExpress.Wpf.Core

Declaration

csharp
public void FillRectangle(
    GraphicsCache cache,
    Rectangle bounds
)
vb
Public Sub FillRectangle(
    cache As GraphicsCache,
    bounds As Rectangle
)

Parameters

NameTypeDescription
cacheGraphicsCache

A GraphicsCache object providing storage for the pens, fonts and brushes used during painting.

| | bounds | Rectangle |

A Rectangle value representing the drawing area.

|

Remarks

This method calls the AppearanceObject.DrawBackground method to fill the specified drawing area.

The following code snippets (auto-collected from DevExpress Examples) contain references to the FillRectangle(GraphicsCache, Rectangle) method.

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-print-custom-draw-content/CS/MyXtraGrid/Form1.cs#L36

csharp
e.Appearance.BackColor = Color.Yellow;
e.Appearance.FillRectangle(e.Cache, e.Bounds);
Rectangle rect = e.Bounds;

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

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

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

csharp
return;
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);

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

csharp
public static void DoDefaultDrawCell(GridView view, RowCellCustomDrawEventArgs e) {
    e.Appearance.FillRectangle(e.Cache, e.Bounds);
    ((IViewController)view.GridControl).EditorHelper.DrawCellEdit(new GridViewDrawArgs(e.Cache, (view.GetViewInfo() as GridViewInfo), e.Bounds), (e.Cell as GridCellInfo).Editor, (e.Cell as GridCellInfo).ViewInfo, e.Appearance, (e.Cell as GridCellInfo).CellValueRect.Location);

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

csharp
info.GroupText = " " + info.GroupText.TrimStart();
e.Appearance.FillRectangle(e.Cache, e.Bounds);
e.Painter.DrawObject(e.Info);

winforms-grid-print-custom-draw-content/VB/MyXtraGrid/Form1.vb#L36

vb
e.Appearance.BackColor = Color.Yellow
e.Appearance.FillRectangle(e.Cache, e.Bounds)
Dim rect As Rectangle = e.Bounds

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

vb
Private Sub DrawGroupRow(ByVal e As DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs)
    e.Appearance.FillRectangle(e.Cache, e.Bounds)
    e.Painter.DrawObject(e.Info)

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

vb
If filterTextIndex = -1 Then Return
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)

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

vb
Public Shared Sub DoDefaultDrawCell(ByVal view As GridView, ByVal e As RowCellCustomDrawEventArgs)
    e.Appearance.FillRectangle(e.Cache, e.Bounds)
    CType(view.GridControl, IViewController).EditorHelper.DrawCellEdit(New GridViewDrawArgs(e.Cache, (TryCast(view.GetViewInfo(), GridViewInfo)), e.Bounds), (TryCast(e.Cell, GridCellInfo)).Editor, (TryCast(e.Cell, GridCellInfo)).ViewInfo, e.Appearance, (TryCast(e.Cell, GridCellInfo)).CellValueRect.Location)

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

vb
info.GroupText = " " & info.GroupText.TrimStart()
e.Appearance.FillRectangle(e.Cache, e.Bounds)
e.Painter.DrawObject(e.Info)

See Also

DrawBackground

AppearanceObject Class

AppearanceObject Members

DevExpress.Utils Namespace