Back to Devexpress

AppearanceObject.GetBackBrush(GraphicsCache) Method

windowsforms-devexpress-dot-utils-dot-appearanceobject-dot-getbackbrush-x28-devexpress-dot-utils-dot-drawing-dot-graphicscache-x29.md

latest6.5 KB
Original Source

AppearanceObject.GetBackBrush(GraphicsCache) Method

Gets the solid brush used to draw the element’s background.

Namespace : DevExpress.Utils

Assembly : DevExpress.Utils.v25.2.dll

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

Declaration

csharp
public Brush GetBackBrush(
    GraphicsCache cache
)
vb
Public Function GetBackBrush(
    cache As GraphicsCache
) As Brush

Parameters

NameTypeDescription
cacheGraphicsCache

A GraphicsCache object that provides access to the pens and brushes used for painting.

|

Returns

TypeDescription
Brush

A Brush descendant representing the brush specified by the appearance object’s settings.

|

Remarks

If the cache parameter’s value is not a null reference, the GetBackBrush method uses the GraphicsCache object to obtain the solid brush whose color is specified by the background color settings of the current appearance object. This lets you obtain the brush quicker as it may already be stored within a cache. Otherwise, a new System.Drawing.SolidBrush object with appropriate settings is created and returned.

Use the AppearanceObject.GetBackColor method to obtain the background color specified by the appearance object’s settings.

The following code snippets (auto-collected from DevExpress Examples) contain references to the GetBackBrush(GraphicsCache) 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-enable-editing-in-group-row-to-change-cell-values/CS/WindowsApplication3/GroupEditProvider.cs#L210

csharp
editViewInfo.CalcViewInfo(e.Graphics);
e.Cache.FillRectangle(viewInfo.PaintAppearance.Row.GetBackBrush(e.Cache), HotTrackRectangle);
groupEditPainter.Draw(new ControlGraphicsInfoArgs(editViewInfo, e.Cache, HotTrackRectangle));

winforms-grid-keep-groups-expanded/CS/KeepGroupsExpanded/Form1.cs#L29

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

winforms-buttonedit-customize-button-paddings/CS/ButtonEditWithPadding/PaddingButtonEditPainter.cs#L17

csharp
{
    Brush b = viewInfo.PaintAppearance.GetBackBrush(info.Cache);
    info.Graphics.FillRectangle(b, info.Bounds);

winforms-grid-display-custom-rows/CS/CustomRowInGrid/CustomRowInGrid/BlankItem.cs#L38

csharp
e.Cache.FillRectangle(gri.Appearance.GetBackBrush(e.Cache), drawRect);
drawRect.Inflate(-3, -3);

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

vb
editViewInfo.CalcViewInfo(e.Graphics)
e.Cache.FillRectangle(viewInfo.PaintAppearance.Row.GetBackBrush(e.Cache), HotTrackRectangle)
groupEditPainter.Draw(New ControlGraphicsInfoArgs(editViewInfo, e.Cache, HotTrackRectangle))

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

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

winforms-buttonedit-customize-button-paddings/VB/ButtonEditWithPadding/PaddingButtonEditPainter.vb#L14

vb
If TypeOf viewInfo Is PaddingButtonEditViewInfo Then
    Dim b As Brush = viewInfo.PaintAppearance.GetBackBrush(info.Cache)
    info.Graphics.FillRectangle(b, info.Bounds)

winforms-grid-display-custom-rows/VB/CustomRowInGrid/BlankItem.vb#L37

vb
e.Cache.FillRectangle(gri.Appearance.GetBackBrush(e.Cache), drawRect)
drawRect.Inflate(-3, -3)

See Also

GetBackColor

GetBackPen

AppearanceObject Class

AppearanceObject Members

DevExpress.Utils Namespace