abcxpg 发表于 2015-2-6 13:40:00

图片在文本框中保存不了

//增加文本框
TXTextControl.TextFrame TF = new TXTextControl.TextFrame(200, 200);
textControl1.TextFrames.Add(TF, TXTextControl.HorizontalAlignment.Left, -1, TXTextControl.TextFrameInsertionMode.DisplaceText);

//在文本框中增加图片
if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
             TXTextControl.Image NewImage = new TXTextControl.Image();

             NewImage.FileName = openFileDialog1.FileName;
             NewImage.SaveMode = TXTextControl.ImageSaveMode.SaveAsData;   
    TXTextControl.TextFrame TF=textControl1.TextFrames.GetItem();   

             if(TF!=null)         
            textControl1.TextFrames.GetItem().Images.Add(NewImage, TXTextControl.HorizontalAlignment.Left, -1,
                                                   TXTextControl.ImageInsertionMode.DisplaceText);
}
//保存
textControl1.Save(TXTextControl.StreamType.All);

问题
1、在文本框中插入图片保存再加载是空白的。
2、怎么样获取文本框的坐标,想实现从其它地方拖拉一个图片到文本框中

iceman 发表于 2015-2-6 16:28:00

回复 1楼abcxpg的帖子

问题已经重现了,我会反馈给厂商,有进一步结果反馈给你。

abcxpg 发表于 2015-2-6 19:30:00

好的,谢谢!

iceman 发表于 2015-2-9 13:50:00

回复 3楼abcxpg的帖子

问题已经提交给厂商,收到进一步反馈后通知你。谢谢

iceman 发表于 2015-2-10 13:48:00

回复 3楼abcxpg的帖子

如果需要导出 TextFrame 中的 image,需要通过以下方法:

      private void addImageToolStripMenuItem_Click(object sender, EventArgs e)
      {
            //在文本框中增加图片
            if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                TXTextControl.Image NewImage = new TXTextControl.Image();

                NewImage.FileName = openFileDialog1.FileName;
                NewImage.SaveMode = TXTextControl.ImageSaveMode.SaveAsFileReference;
                TXTextControl.TextFrame TF = textControl1.TextFrames.GetItem(1001);

                if (TF != null)
                  TF.Images.Add(NewImage,0);
            }
      }


1#方法需要通过保存为 TextControl 内置文件格式 .tx 来保存。
页: [1]
查看完整版本: 图片在文本框中保存不了