DevExpress的GridControl如何实现打印和打印预览
2011-12-07 17:14
441 查看
第一种方法:
System.Drawing.Printing.PageSettings set_print_page = new System.Drawing.Printing.PageSettings();
DevExpress.XtraPrinting.DynamicPrintHelper ph = new DevExpress.XtraPrinting.DynamicPrintHelper();
if (ph.IsPrintingAvailable)
{
ph.PageSettings = set_print_page;
ph.PageSettings.Landscape = true;
ph.ShowPreview(this.gc, true);
}
第二种方法:
if (DevExpress.XtraPrinting.PrintHelper.IsPrintingAvailable)
{
DataRowView drv = (DataRowView)BS_Roads.Current;
PrintingSystem ps = new PrintingSystem();
PrintableComponentLink link = new PrintableComponentLink(ps);
link.Component = gc;
link.Landscape = true;
PageHeaderFooter phf = link.PageHeaderFooter as PageHeaderFooter;
phf.Header.Content.Clear();
phf.Header.Content.AddRange(new string[] { "", drv["线路名"].ToString() + "站点信息表", "" });
phf.Header.Font = new System.Drawing.Font("宋体", 16, System.Drawing.FontStyle.Regular);
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();
}
else
{
XtraMessageBox.Show("打印机不可用...", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
System.Drawing.Printing.PageSettings set_print_page = new System.Drawing.Printing.PageSettings();
DevExpress.XtraPrinting.DynamicPrintHelper ph = new DevExpress.XtraPrinting.DynamicPrintHelper();
if (ph.IsPrintingAvailable)
{
ph.PageSettings = set_print_page;
ph.PageSettings.Landscape = true;
ph.ShowPreview(this.gc, true);
}
第二种方法:
if (DevExpress.XtraPrinting.PrintHelper.IsPrintingAvailable)
{
DataRowView drv = (DataRowView)BS_Roads.Current;
PrintingSystem ps = new PrintingSystem();
PrintableComponentLink link = new PrintableComponentLink(ps);
link.Component = gc;
link.Landscape = true;
PageHeaderFooter phf = link.PageHeaderFooter as PageHeaderFooter;
phf.Header.Content.Clear();
phf.Header.Content.AddRange(new string[] { "", drv["线路名"].ToString() + "站点信息表", "" });
phf.Header.Font = new System.Drawing.Font("宋体", 16, System.Drawing.FontStyle.Regular);
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();
}
else
{
XtraMessageBox.Show("打印机不可用...", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
相关文章推荐
- DevExpress的GridControl如何实现打印和打印预览
- DevExpress的GridControl如何实现打印和打印预览 z
- DevExpress的GridControl如何实现打印和打印预览
- DevExpress的GridControl如何实现打印和打印预览
- DevExpress的GridControl如何实现打印和打印预览
- DevExpress的GridControl如何实现打印和打印预览
- 如何显示RepositoryItemHyperLinkEdit控制在一个DevExpress GridControl
- DevExpress实现GridControl根据列选中一行
- DevExpress GridControl如何取消默认的显示方式
- 实现DevExpress GridControl 只有鼠标双击后才进行修改数据
- DevExpress.XtraGrid.GridControl 打印
- DevExpress实现GridControl同步列头checkbox与列中checkbox状态
- 如何在devexpress gridcontrol上显示行号
- DevExpress实现GridControl显示Gif动画的方法
- DevExpress实现GridControl列头绘制Checkbox的方法
- DevExpress GridControl的自动高度和自动换行怎么实现?
- [DevExpress]实现GridControl输入验证
- devexpress表格gridcontrol实现列统计,总计,平均,求和等。
- 转:本文介绍了在使用DevExpress GridControl的开发过程中如何设置列数据的格式。
- 如何在列表数据中使用打印按钮实现打印预览