简体   繁体   English

C# GemBox 如何获取TextBox或Shape的position

[英]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.我想知道如何在 GemBox DLL 中获取 TextBox 或 Shape 的 position。

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.现在我想访问水平和垂直 position。

Thanks for any help.谢谢你的帮助。

Use this:用这个:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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