打印grid

void PrintButtonClick(object sender, EventArgs e)
{
PrintPreviewDialog dlg = new PrintPreviewDialog(); //page setting
PageSetupDialog psp = new PageSetupDialog();
psp.AllowMargins = true;
SourceGrid.Exporter.GridPrintDocument pd = new SourceGrid.Exporter.GridPrintDocument(this.grid); //页边距开关 若关闭:打印时页边距设置无效、不起作用的原因及解决方法
pd.OriginAtMargins = true;
//是否 横向打印
pd.DefaultPageSettings.Landscape = true;
//左边距 左边距宽度(以百分之一英寸为单位)
pd.DefaultPageSettings.Margins.Left = ;
psp.PageSettings = pd.DefaultPageSettings;
//显示 英寸还是毫米
psp.EnableMetric = true; if (psp.ShowDialog() == DialogResult.OK)
{
pd.DefaultPageSettings = psp.PageSettings;
} pd.RangeToPrint = new SourceGrid.Range(, , this.grid.Rows.Count - , this.grid.Columns.Count - );
pd.PageHeaderText = "Print sample\t\tSourceGrid print document sample";
pd.PageTitleText = "\tSample grid";
pd.PageFooterText = "\tPage [PageNo] from [PageCount]";
dlg.Document = pd;
dlg.ShowDialog(this);
}
上一篇:nginx高性能WEB服务器系列之二命令管理


下一篇:EasyUI的combobox控件使用onchange 问题