可以参考下面的代码因为在tx文档中,单位不是像素而是twips,和像素之间需要进行转换
- Point p=_textControl.InputPosition.Location;
- int dpiX = 15;
- int left = (p.X - _textControl.ScrollLocation.X) / dpiX;
- int top = (p.Y - _textControl.ScrollLocation.Y) / dpiX;
- System.Windows.Forms.Button btn = new System.Windows.Forms.Button() { Text = "dfdd" };
- btn.Location = new Point(left,top);
- _textControl.Controls.Add(btn);
复制代码 |