Back to Devexpress

AppearanceObject.DrawBackground(GraphicsCache, Rectangle) Method

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

latest3.7 KB
Original Source

AppearanceObject.DrawBackground(GraphicsCache, Rectangle) Method

Draws the background for the area contained within the specified boundary.

Namespace : DevExpress.Utils

Assembly : DevExpress.Utils.v25.2.dll

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

Declaration

csharp
public void DrawBackground(
    GraphicsCache cache,
    Rectangle bounds
)
vb
Public Sub DrawBackground(
    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 structure specifying the drawing area.

|

The following code snippets (auto-collected from DevExpress Examples) contain references to the DrawBackground(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-listbox-item-templates-enable-word-wrap/CS/S131055/Form1.cs#L44

csharp
ListBoxControl control = (ListBoxControl)sender;
e.Appearance.DrawBackground(e.Cache, e.Bounds);
TextUtils.DrawString(e.Graphics, control.GetItemText(e.Index), control.Appearance.Font,

create-custom-editor-with-auto-height-functionality/CS/TreeListAutoNodeHeight/TreeListAutoNodeHeight/CustomAnyControlEditPainter.cs#L13

csharp
{
    info.ViewInfo.PaintAppearance.DrawBackground(info.Cache, info.Bounds);
    info.ViewInfo.PaintAppearance.DrawString(info.Cache, info.ViewInfo.DisplayText, info.Bounds);

winforms-listbox-item-templates-enable-word-wrap/VB/S131055/Form1.vb#L43

vb
Dim control As ListBoxControl = CType(sender, ListBoxControl)
e.Appearance.DrawBackground(e.Cache, e.Bounds)
TextUtils.DrawString(e.Graphics, control.GetItemText(e.Index), control.Appearance.Font, control.Appearance.ForeColor, e.Bounds)

See Also

AppearanceObject Class

AppearanceObject Members

DevExpress.Utils Namespace