简体   繁体   中英

C# GemBox How to get the position of a TextBox or Shape

I was wondering how I can get the position of a TextBox or a Shape inside the GemBox DLL.

This is my TextBox:

var textBox1 = new TextBox(document, Layout.Floating(
    new HorizontalPosition(15, LengthUnit.Pixel, HorizontalPositionAnchor.TopLeftCorner),
    new VerticalPosition(70, LengthUnit.Pixel, VerticalPositionAnchor.TopLeftCorner),
    new Size(pageSetup.PageWidth - 175, 100, LengthUnit.Point)),
    ShapeType.RoundedRectangle);

textBox1.AdjustValues["adj"] = 5000;
textBox1.Outline.Fill.SetEmpty();
textBox1.Fill.SetSolid(Color.White);

Now I want to get access to the Horizontal and Vertical position.

Thanks for any help.

Use this:

if (textBox1.Layout.IsFloating)
{
    var layout = (FloatingLayout)textBox1.Layout;
    var horizontalPosition = layout.HorizontalPosition;
    var verticalPosition = layout.VerticalPosition;
    // ...
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM