找回密码
 立即注册

QQ登录

只需一步,快速开始

DCAgile

中级会员

83

主题

247

帖子

794

积分

中级会员

积分
794

活字格认证微信认证勋章元老葡萄

DCAgile
中级会员   /  发表于:2015-9-22 17:05  /   查看:9383  /  回复:11
使用如下代码实现图片添加:
        string FilePath1 = Application.StartupPath + "\\Image\\1.png";
        string FilePath2 = Application.StartupPath + "\\Image\\2.png";
        string FilePath3 = Application.StartupPath + "\\Image\\3.png";
        string FilePath4 = Application.StartupPath + "\\Image\\4.png";

private void AddImage()
        {
            System.Drawing.Image img = System.Drawing.Image.FromFile(FilePath1);
            System.Drawing.Image img2 = System.Drawing.Image.FromFile(FilePath2);
            System.Drawing.Image img3 = System.Drawing.Image.FromFile(FilePath3);
            System.Drawing.Image img4 = System.Drawing.Image.FromFile(FilePath4);

            List<System.Drawing.Image> list = new List<System.Drawing.Image>();
            list.Add(img);
            list.Add(img2);
            list.Add(img3);
            list.Add(img4);

            for (int i = 0; i < list.Count; i++)
            {
                System.Drawing.Image thumbImage = list.GetThumbnailImage(200, 200, null, System.IntPtr.Zero);
                TXTextControl.Image image = new TXTextControl.Image(thumbImage);
                textControl1.Images.Add(image, textControl1.InputPosition.TextPosition);
            }
        }

问题:1.如何为每张图片添加间隔??效果如下所示:
test.PNG

11 个回复

正序浏览
iceman
社区贡献组   /  发表于:2015-9-25 16:43:00
12#
回复 10楼DCAgile的帖子

你好,
很抱歉,目前没有更便捷的方法设置Table的GridLine,只能全部设置后,再设置特定table的border来实现。
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2015-9-25 16:24:00
11#
回复 10楼DCAgile的帖子

已经发送邮件给厂商,看是否有直接设置特定Table的接口。
回复 使用道具 举报
DCAgile
中级会员   /  发表于:2015-9-25 16:14:00
10#
回复 9楼iceman的帖子

这种方式只适用于使用代码添加的表格,对于创建模版添加的表格无法操作
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2015-9-25 15:17:00
9#
回复 8楼DCAgile的帖子

设置Border测试代码如下:

  1.         private void Form1_Load(object sender, EventArgs e)
  2.         {
  3.             this.textControl1.Tables.Add(10, 10, 11);
  4.             this.textControl1.Selection.Text = &quot;\n\n\n\n&quot;;
  5.             this.textControl1.Tables.Add(10, 10, 12);
  6.             this.textControl1.Tables.GridLines = false;
  7.         }

  8.         private void setBorderToolStripMenuItem_Click(object sender, EventArgs e)
  9.         {
  10.             Table tb = this.textControl1.Tables.GetItem(11);
  11.             

  12.             foreach (TableCell cell in this.textControl1.Tables.GetItem(11).Cells)
  13.             {
  14.                 cell.CellFormat.TopBorderWidth = 20;
  15.                 cell.CellFormat.LeftBorderWidth= 20;
  16.                 cell.CellFormat.RightBorderWidth = 20;
  17.                 cell.CellFormat.BottomBorderWidth = 20;
  18.             }
  19.         }
复制代码
回复 使用道具 举报
DCAgile
中级会员   /  发表于:2015-9-25 14:55:00
8#
回复 7楼DCAgile的帖子

不用回了 问题已解决
回复 使用道具 举报
DCAgile
中级会员   /  发表于:2015-9-25 14:14:00
7#
回复 6楼iceman的帖子

问题:
1.单元格左右对齐方式需要通过 ParagraphFormat.Alignment 属性来设置。
  和你电话沟通,说需通过Selection选中当前行,进行设置,还是不太清楚 怎么获取,,

  具体应该怎么操作??
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2015-9-25 12:29:00
6#
回复 5楼DCAgile的帖子

TableID从 11开始设置,需要大于10。
Table边框可以通过以下代码隐藏:

  1.             this.textControl1.Tables.GridLines = false;
复制代码


对齐方式需要单元格逐个设置:

  1. private void setBorderToolStripMenuItem_Click(object sender, EventArgs e)
  2.         {
  3.             Table tb = this.textControl1.Tables.GetItem(12);
  4.             

  5.             foreach (TableCell cell in this.textControl1.Tables.GetItem(12).Cells)
  6.             {
  7.                 cell.CellFormat.VerticalAlignment = VerticalAlignment.Top;
  8.             }
  9.         }
复制代码


单元格左右对齐方式需要通过 ParagraphFormat.Alignment 属性来设置。
回复 使用道具 举报
DCAgile
中级会员   /  发表于:2015-9-25 11:22:00
5#
回复 4楼iceman的帖子

问题:
1.TX Control中添加Table——Id设置是否有什么限制(设置为1、2出错)?

2.如何设置Table的边框、对其方式、单元格高度(通过编码的方式)?
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2015-9-24 11:19:00
地板
回复 3楼DCAgile的帖子

建议通过Table来布局,在单元格中插入图片。请您想尝试,有后续问题我们再讨论。
回复 使用道具 举报
12下一页
您需要登录后才可以回帖 登录 | 立即注册
返回顶部