windowsforms-devexpress-dot-xtradiagram-dot-diagramitem-bcd6050e.md
Gets or sets the item width.
Namespace : DevExpress.XtraDiagram
Assembly : DevExpress.XtraDiagram.v25.2.dll
NuGet Package : DevExpress.Win.Diagram
[DXCategory("Layout")]
[Browsable(false)]
public virtual float Width { get; set; }
<DXCategory("Layout")>
<Browsable(False)>
Public Overridable Property Width As Single
| Type | Description |
|---|---|
| Single |
A Single value, specifying the item width in pixels.
|
The following code snippets (auto-collected from DevExpress Examples) contain references to the Width 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.
var margin = 3f;
e.Graphics.DrawImage(image, new RectangleF(shape.Width - image.Width - margin, shape.Height - image.Height - margin, image.Width, image.Height));
e.Handled = true;
winforms-diagram-proportionally-resize-shapes-within-container/CS/WindowsFormsApp4/Form1.cs#L45
customContainer.Position = new PointFloat((float)containingRect.X, (float)containingRect.Y);
customContainer.Width = (float)containingRect.Width;
customContainer.Height = (float)containingRect.Height;
winforms-diagram-create-rotatable-containers-with-shapes/CS/WindowsFormsApp4/Form1.cs#L44
container.Position = new PointFloat((float)containingRect.X, (float)containingRect.Y);
container.Width = (float)containingRect.Width;
container.Height = (float)containingRect.Height;
winforms-diagram-track-and-restrict-drag-actions/CS/WinApp7/Form1.cs#L52
if (item.Item is DiagramShape shape && shape.Shape == BasicShapes.Pentagon) {
var itemRect = new System.Windows.Rect(new System.Windows.Point(item.NewDiagramPosition.X, item.NewDiagramPosition.Y), new System.Windows.Size(item.Item.Width, item.Item.Height));
foreach (var diagramShape in diagramControl1.Items.OfType<DiagramShape>().Where(x => x != shape)) {
winforms-diagram-create-custom-toolbox/CS/CustomDiagramToolboxExample/Form1.cs#L44
e.Cache.TranslateTransform(e.Bounds.X, e.Bounds.Y);
shapeItem.Width = 40;
shapeItem.Height = e.Bounds.Height;
Dim margin = 3F
e.Graphics.DrawImage(image, New RectangleF(shape.Width - image.Width - margin, shape.Height - image.Height - margin, image.Width, image.Height))
e.Handled = True
winforms-diagram-proportionally-resize-shapes-within-container/VB/WindowsFormsApp4/Form1.vb#L47
customContainer.Position = New PointFloat(CSng(containingRect.X), CSng(containingRect.Y))
customContainer.Width = CSng(containingRect.Width)
customContainer.Height = CSng(containingRect.Height)
winforms-diagram-create-rotatable-containers-with-shapes/VB/WindowsFormsApp4/Form1.vb#L48
container.Position = New PointFloat(CSng(containingRect.X), CSng(containingRect.Y))
container.Width = CSng(containingRect.Width)
container.Height = CSng(containingRect.Height)
winforms-diagram-create-custom-toolbox/VB/CustomDiagramToolboxExample/Form1.vb#L45
e.Cache.TranslateTransform(e.Bounds.X, e.Bounds.Y)
shapeItem.Width = 40
shapeItem.Height = e.Bounds.Height
See Also