回复 1楼guojuanbo的帖子
链接中提供了 TX WinForms 调整页面大小的解决方法:
http://www.textcontrol.com/en_US/blog/archive/20080508/
关键代码:
- private void textControl1_ImageCreated(object sender, TXTextControl.ImageEventArgs e)
- {
- // get screen resolution to convert twips to pixel
- int iTwipsPerPixel = (int)(1440 / textControl1.CreateGraphics().DpiX);
-
- if (((float)(e.Image.Size.Width / iTwipsPerPixel)) >= (textControl1.Sections.GetItem().Format.PageSize.Width - textControl1.Sections.GetItem().Format.PageMargins.Left - textControl1.Sections.GetItem().Format.PageMargins.Right))
- {
- // resize the image
- float fScaleFactor = ((textControl1.Sections.GetItem().Format.PageSize.Width - textControl1.Sections.GetItem().Format.PageMargins.Left - textControl1.Sections.GetItem().Format.PageMargins.Right) / ((float)(e.Image.Size.Width / iTwipsPerPixel))) * 100;
- e.Image.VerticalScaling = Convert.ToInt32(fScaleFactor);
- e.Image.HorizontalScaling = Convert.ToInt32(fScaleFactor);
- }
- }
复制代码
TX ActiveX 版本中对应 textControl1_ImageCreated 事件的接口为 TXTextControl.ObjectCreated。 |