回复 3楼mindrayguowei的帖子
可以通过 Image 类来获取图片的实际尺寸,然后再通过 DpiX 转换为 TX 尺寸设置给 Cell 即可。请使用以下代码测试:
- private void addimageToolStripMenuItem_Click(object sender, EventArgs e)
- {
- Image img = Image.FromFile("..\\..\\test.png");
- TXTextControl.Image image = new TXTextControl.Image(img);
- this.textControl1.Images.Add(image,0);
- TXTextControl.TableCell cell = this.textControl1.Tables.GetItem(11).Cells.GetItem(1, 1);
- int iTwipsPerPixel = (int)(1440 / textControl1.CreateGraphics().DpiX);
- cell.Width = img.Width*iTwipsPerPixel;
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- this.textControl1.Text = "";
- this.textControl1.Tables.Add(2,2,11);
- }
复制代码 |