Back to Devexpress

ListBoxDrawItemEventArgs.Bounds Property

windowsforms-devexpress-dot-xtraeditors-dot-listboxdrawitemeventargs-29fc9611.md

latest3.1 KB
Original Source

ListBoxDrawItemEventArgs.Bounds Property

Gets the bounding rectangle of the item being painted.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public Rectangle Bounds { get; set; }
vb
Public Property Bounds As Rectangle

Property Value

TypeDescription
Rectangle

A Rectangle structure specifying the painted item’s boundaries.

|

Remarks

To paint an item displayed within the list box control you must define the Graphics object used to paint it and provide the rectangle specifying the item’s boundaries. When painting, you can access these values via the event parameter’s Bounds property.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Bounds 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-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,

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

State

DrawItem

ListBoxDrawItemEventArgs Class

ListBoxDrawItemEventArgs Members

DevExpress.XtraEditors Namespace