找回密码
 立即注册

QQ登录

只需一步,快速开始

牛魔王

注册会员

6

主题

20

帖子

190

积分

注册会员

积分
190

微信认证勋章

牛魔王
注册会员   /  发表于:2016-1-19 17:09  /   查看:5735  /  回复:8
  1. namespace C1FlexGridTest01
  2. {
  3.     public partial class FlyFile : Form
  4.     {
  5.         public FlyFile()
  6.         {
  7.             InitializeComponent();
  8.         }
  9.   
  10.         private void FlyFile_Load(object sender, EventArgs e)
  11.         {
  12.             this.c1PrintDocument1.StartDoc();   

  13.             C1.C1Preview.RenderTable theader = new C1.C1Preview.RenderTable(this.c1PrintDocument1);
  14.             theader.Cells[0, 0].Style.TextAlignHorz = C1.C1Preview.AlignHorzEnum.Left;
  15.             theader.Cells[0, 2].Style.TextAlignHorz = C1.C1Preview.AlignHorzEnum.Right;
  16.             theader.CellStyle.Font = new Font("Arial", 8, FontStyle.Italic);

  17.             theader.Cells[0, 0].Text = "中国南方航空";
  18.             theader.Cells[0, 2].Text = "飞行文件";
  19.             this.c1PrintDocument1.RenderBlock(theader);

  20.             this.c1PrintDocument1.RenderInlineText("武汉(ZHHH)-北京(ZBAA)航空气象情报", new Font("", 20, FontStyle.Bold), Color.FromArgb(0, 0, 125));
  21.             this.c1PrintDocument1.RenderInlineEnd();
  22.             this.c1PrintDocument1.RenderInlineText("METAR ZBAA 140730Z VRB02MPS CAVOK 27/01 Q1006 NOSIG= ", new Font("", 12, FontStyle.Regular), Color.Black);
  23.             this.c1PrintDocument1.RenderInlineEnd();
  24.             this.c1PrintDocument1.EndDoc();
  25.         }
  26.     }
  27. }
复制代码


窗体就 c1PrintPreviewControl1   和 c1PrintDocument1控件  怎么能让一行文字居中?
还有就是怎么放一张或者多张图片上去?(每张图需要打印成一张A4大小,需要让图片旋转90度,铺满A4纸)
我的文本内容都是存在List里面的


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x

8 个回复

倒序浏览
Alice
社区贡献组   /  发表于:2016-1-20 09:35:00
沙发
回复 1楼牛魔王的帖子

根据我的理解,您有两个问题:
1.RenderlineText居中。可以使用RenderInlineText(String, Style)构造方法,通过Style传入文字居中。
Style中的TextAlignHorz属性可以控制文字水平居中。
产品文档:http://helpcentral.componentone. ... .Style_members.html

2.可以通过RenderImage将图片放到特定的位置。
具体做法请参考产品文档:http://helpcentral.componentone. ... cellsofthetable.htm
对于控制Image的角度等,可以使用RenderImage的Style。
RenderImage的接口产品文档:http://helpcentral.componentone. ... cellsofthetable.htm

Style的接口在问题1中的链接,里面有属性可以设置。
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
牛魔王
注册会员   /  发表于:2016-1-20 10:36:00
板凳
给我个源码可以吗?
我下面这样子居中不起作用
  1. this.c1PrintDocument1.StartDoc();
  2.             Style s = this.c1PrintDocument1.Style.Children.Add();
  3.             s.TextAlignHorz = C1.C1Preview.AlignHorzEnum.Center;
  4.             s.Font = new Font("微软雅黑", 20, FontStyle.Italic);
  5.             s.Borders.All = new LineDef("1mm", Color.Red);
  6.             s.BackColor = Color.CadetBlue;
  7.             RenderText rt = new RenderText("123456");
  8.             rt.Style.Parent = s;
  9.             this.c1PrintDocument1.RenderBlock(rt);
  10.             this.c1PrintDocument1.EndDoc();
复制代码
回复 使用道具 举报
牛魔王
注册会员   /  发表于:2016-1-20 10:38:00
地板
回复 2楼Alice的帖子

求解,多谢
回复 使用道具 举报
Alice
社区贡献组   /  发表于:2016-1-20 14:17:00
5#
回复 3楼牛魔王的帖子

直接设置Style.TextAlignHorz属性就可以起作用。
  1.   RenderText rt = new RenderText("123456");
  2.             rt.Style.BackColor = Color.CadetBlue;
  3.             rt.Style.TextAlignHorz = AlignHorzEnum.Center;
复制代码
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
牛魔王
注册会员   /  发表于:2016-1-21 15:01:00
6#
回复 5楼Alice的帖子
  1. this.c1PrintDocument1.RenderBlockImage(image);
复制代码




能不能让图片旋转一下横着放,铺满A4纸?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 使用道具 举报
牛魔王
注册会员   /  发表于:2016-1-21 15:32:00
7#
还有就是这个 c1PrintDocument 有没有padding之内的属性, 用来设置不同段落之间的间隔,这个间隔无法使用LineSpacing来设置,要怎么设置?求代码,文档看过了 没找到,谢过
回复 使用道具 举报
牛魔王
注册会员   /  发表于:2016-1-21 16:32:00
8#
回复 7楼牛魔王的帖子

这个已解决,找到padding属性了
回复 使用道具 举报
Alice
社区贡献组   /  发表于:2016-1-21 17:04:00
9#
回复 6楼牛魔王的帖子

图片的样式可以通过Style来设置。
接口已经在2楼的链接中给出。

C1PageSetting类可以用来设置页面,接口可以参考文档:
http://helpcentral.componentone. ... ttings_members.html
宽度以及上下左右的间距都可以设置。
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部