没有合适的资源?快使用搜索试试~ 我知道了~
DevExpress打印相关代码
需积分: 41 27 下载量 196 浏览量
2010-01-20
14:03:49
上传
评论
收藏 76KB PDF 举报
温馨提示
试读
13页
DevExpress打印相关代码DevExpress打印相关代码DevExpress打印相关代码DevExpress打印相关代码
资源推荐
资源详情
资源评论
PrintingSystem ps = new PrintingSystem(); //建立一个打印系统
PrintableComponentLink link = new PrintableComponentLink(ps);
ps.Links.Add(link); //建立可打印组件链接,并与打印系统关联
link.Component = gridControl2; //设置要打印的控件(注意是
gricControl1,不是gridView1)
//得到链接的页眉页脚
PageHeaderFooter phf = link.PageHeaderFooter as
PageHeaderFooter;
//设置页眉
phf.Header.Content.Clear();
//内容格式:左,中,右
phf.Header.Content.AddRange(new string[] { "", "系统帐号列表",
"" });
//指定个字体,好看些
phf.Header.Font = new System.Drawing.Font("黑体", 22,
System.Drawing.FontStyle.Bold);
//这个是让页眉标题垂直居中,我想多数人都会需要吧
phf.Header.LineAlignment = BrickAlignment.Center;
phf.Footer.Content.Clear();
phf.Footer.Content.AddRange(new string[] { "", String.Format("
打印时间: {0:g}", DateTime.Now), "" });
link.CreateDocument();
//呵呵,来看看效果吧
link.ShowPreview();
1
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
namespace BKGL
{
class DevPrint
{
//*********************字段*********************
private string pageHeaderName = "";
private string pageFooterName = "";
private bool isPrintPage = true;
private bool isPrintDate = true;
private int headerLocation = 1;
private int footerLocation = 1;
private int pageLocation = 3;
private int dateLocation = 5;
private bool enableEditPage = true;
private System.Drawing.Font pageHeaderFont = null;
private System.Drawing.Font pageFooterFont = null;
private System.Drawing.Printing.Margins devMargins = null;
private System.Drawing.Printing.PaperKind
devPaperKind =
System.Drawing.Printing.PaperKind.A4;//可以自定
义修改纸张
private DevExpress.XtraPrinting.PageHeaderArea PHA = new
DevExpress.XtraPrinting.PageHeaderArea();
private DevExpress.XtraPrinting.PageFooterArea PFA = new
DevExpress.XtraPrinting.PageFooterArea();
//*********************字段*********************
//*********************属性*********************
//标题
public string PageHeaderName
{
get
{
return pageHeaderName;
}
set
{
pageHeaderName = value;
}
}
//页脚
public string PageFooterName
{
get
{
return pageFooterName;
}
set
{
pageFooterName = value;
2
}
}
//是否打印页数
public bool IsPrintPage
{
get
{
return isPrintPage;
}
set
{
isPrintPage = value;
}
}
//是否打印时间
public bool IsPrintDate
{
get
{
return isPrintDate;
}
set
{
isPrintDate = value;
}
}
//header的位置(左,中,右)(0,1,2)
public int HeaderLocation
{
get
{
return headerLocation;
}
set
{
headerLocation = value;
}
}
//footer的位置(左,中,右)(0,1,2)
public int FooterLocation
{
get
{
return footerLocation;
}
set
{
footerLocation = value;
}
}
3
剩余12页未读,继续阅读
资源评论
adongbatman
- 粉丝: 3
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功