开发者论坛

 找回密码
 注册 (请使用非IE浏览器)
查看: 3208|回复: 2

gridControl打印怎么加水印???????????

[复制链接]

0

精华

0

贡献

1

赞扬

帖子
51
软币
466
在线时间
52 小时
注册时间
2014-7-22
发表于 2015-12-29 09:32:38 | 显示全部楼层 |阅读模式
gridControl打印,用PrintingSystem能调整纸张大小、纸张方向、页边距,可怎么加图片水印呢?
有没有高手指教指教???
回复

使用道具 举报

0

精华

0

贡献

1

赞扬

帖子
51
软币
466
在线时间
52 小时
注册时间
2014-7-22
 楼主| 发表于 2016-1-20 10:26:29 | 显示全部楼层
自己解决!
if (gridControl1.DataSource != null)
  {
    PrintingSystem ps = new PrintingSystem();
    PrintableComponentLink link = null;
    link = new PrintableComponentLink(ps);
    ps.Links.Add(link);
    link.Component = gridControl1;
    link.CreateDocument();
    ps.PageSettings.PaperKind = PaperKind.A4;                        //纸张大小
    ps.PageSettings.Landscape = true;                                   //是否为横向打印
    ps.PageSettings.TopMargin = 76;                                     //上边距
    ps.PageSettings.BottomMargin = 76;                                //下边距
    ps.PageSettings.LeftMargin = 44;                                   //左边距
    ps.PageSettings.RightMargin = 44;                                     //右边距
    ps.Watermark.Image = Bitmap.FromFile("dabiao.png");              //设置水印图片
    ps.Watermark.ImageAlign = ContentAlignment.MiddleCenter;      //水印对齐方式
    ps.Watermark.ImageTiling = false;                                            //是否平铺图片
    ps.Watermark.ImageViewMode = ImageViewMode.Stretch;         //设置图片显示方式
    ps.Watermark.ImageTransparency = 200;                                  //设置水印图片的深浅度
    ps.Watermark.ShowBehind = false;                                           //设置水印在打印内容的前面显示
    ps.Print();                                       //直接打印,不显示打印预览
  }
回复

使用道具 举报

0

精华

0

贡献

0

赞扬

帖子
22
软币
107
在线时间
7 小时
注册时间
2015-12-30
发表于 2016-1-23 09:35:53 | 显示全部楼层
天罡北斗 发表于 2016-1-20 10:26
自己解决!
if (gridControl1.DataSource != null)
  {

我也试试,希望好用啊
回复

使用道具 举报

Archiver|手机版|小黑屋|开发者网 ( 苏ICP备08004430号-2 )
版权所有:南京韵文教育信息咨询有限公司

GMT+8, 2024-6-16 13:55

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表