Back to Devexpress

Shape.ZOrderPosition Property

officefileapi-devexpress-dot-spreadsheet-dot-shape-d21b4109.md

latest4.1 KB
Original Source

Shape.ZOrderPosition Property

Gets the position of the current drawing object in the z-order.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
int ZOrderPosition { get; set; }
vb
Property ZOrderPosition As Integer

Property Value

TypeDescription
Int32

An integer that indicates the position in the z-order.

|

Remarks

When drawing objects are added to the Worksheet.Shapes collection, the ZOrderPosition value is incremented by one starting from 1. You can increase the ZOrderPosition property value to move the drawing object in front of all objects with a lower ZOrderPosition. The ShapeCollection.NormalizeZOrder method modifies ZOrderPosition values for all drawing objects in a collection so that they become a series of consecutive integers starting from 1.

Example

View Example

vb
workbook.BeginUpdate()
Try
    Dim worksheet As Worksheet = workbook.Worksheets(0)
    ' Insert pictures.
    Dim pic1 As Picture = worksheet.Pictures.AddPicture("Pictures\x-docserver.png", worksheet.Cells("B2"))
    Dim pic2 As Picture = worksheet.Pictures.AddPicture("Pictures\x-spreadsheet.png", worksheet.Cells("C5"))
    ' Bring the first picture to front.
    pic1.ZOrderPosition = 3
Finally
    workbook.EndUpdate()
End Try
csharp
workbook.BeginUpdate();
try
{
    Worksheet worksheet = workbook.Worksheets[0];
    // Insert pictures.
    Picture pic1 = worksheet.Pictures.AddPicture("Pictures\\x-docserver.png", worksheet.Cells["B2"]);
    Picture pic2 = worksheet.Pictures.AddPicture("Pictures\\x-spreadsheet.png", worksheet.Cells["C5"]);
    // Bring the first picture to front.
    pic1.ZOrderPosition = 3;
}
finally
{
    workbook.EndUpdate();
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ZOrderPosition 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-spreadsheetcontrol-api-part-2/CS/SpreadsheetControl_API_Part02/SpreadsheetActions/PictureActions.cs#L151

csharp
// Bring the first picture to front.
    pic1.ZOrderPosition = 3;
}

winforms-spreadsheetcontrol-api-part-2/VB/SpreadsheetControl_API_Part02/SpreadsheetActions/PictureActions.vb#L136

vb
' Bring the first picture to front.
    pic1.ZOrderPosition = 3
Finally

See Also

NormalizeZOrder()

Shape Interface

Shape Members

DevExpress.Spreadsheet Namespace