你好,这是从TX得到的如何判断文档边界的代码,我还没来得及验证,先放上来对比一下与你的代码区别:
- private Rectangle GetPageContentRect(int Page)
- {
- Graphics g = textControl1.CreateGraphics();
- int dpiX = (int)(1440 / g.DpiX);
- TXTextControl.Page page = textControl1.GetPages()[0];
- TXTextControl.Line lastLine = textControl1.Lines.GetItem(page.Start + page.Length - 2);
- Rectangle rRect = new Rectangle(page.TextBounds.X / dpiX, page.TextBounds.Y / dpiX, page.TextBounds.Width / dpiX, lastLine.TextBounds.Bottom / dpiX - page.TextBounds.Top / dpiX);
- return rRect;
- }
复制代码 我验证了以上方法,只能取到正文区域的边界,无法取到Header的边界,看来还得继续和TX联系。 |