这是我生成图片的图片的代码,麻烦帮忙看一下这有没有什么问题?我测试的时候发现输入了内容之后生成图片最后面有些内容没有显示,但是图片的宽度应该是没问题的。- private void ExportImage_Click(object sender, EventArgs e)
- {
- bak_txt_box_.Clear();
- Size page_size = new Size(0, 0);
- byte[] bytes;
- _textControl.Save(out bytes, TXTextControl.BinaryStreamType.InternalFormat);
- bak_txt_box_.Load(bytes, TXTextControl.BinaryStreamType.InternalFormat);
- foreach (TXTextControl.TextChar item in this.bak_txt_box_.TextChars) {
- page_size.Width += item.Bounds.Width;
- page_size.Height = Math.Max(item.Bounds.Height, page_size.Height);
- }
- bak_txt_box_.PageMargins = new TXTextControl.PageMargins(0.0, 0.0, 0.0, 0.0);
- bak_txt_box_.PageUnit = TXTextControl.MeasuringUnit.Twips;
- bak_txt_box_.PageSize = new TXTextControl.PageSize(page_size.Width,
- page_size.Height * 2);
- foreach (TXTextControl.Page page in bak_txt_box_.GetPages()) {
- page.GetImage(100, TXTextControl.Page.PageContent.MainText).Save("D:/pix/" + page.Number + ".png");
- }
- }
- private TXTextControl.TextControl bak_txt_box_ = new TXTextControl.TextControl();
- bak_txt_box_.ViewMode = TXTextControl.ViewMode.PageView;
- bak_txt_box_.CreateControl();
- bak_txt_box_.PageMargins = new TXTextControl.PageMargins(0.0, 0.0, 0.0, 0.0);
- bak_txt_box_.PageUnit = TXTextControl.MeasuringUnit.Twips;
复制代码 |