打印预览问题
TextControl打印预览的时候如何默认窗口最大化? 回复 1楼mindrayguowei的帖子需要自定义 打印预览 对话框,测试代码如下:
private int currentPage = 1;
private int lastPage = 1;
private void Form1_Load(object sender, EventArgs e)
{
PrintDocument pd = new PrintDocument();
PrintPreviewDialog pview = new PrintPreviewDialog();
pd.DocumentName = "Name"; // anything you want here
lastPage = tx.Pages;
pd.PrintPage += new PrintPageEventHandler(OnPrintPage);
pd.PrinterSettings.MinimumPage = 1;
pd.PrinterSettings.MaximumPage = lastPage;
pd.PrinterSettings.FromPage = 1;
pd.PrinterSettings.ToPage = lastPage;
pview.UseAntiAlias = true;
pview.Document = pd;
pview.ShowInTaskbar = true;
pview.WindowState = FormWindowState.Maximized;
pview.Show();
}
private void OnPrintPage(object sender, PrintPageEventArgs ppe)
{
tx.Print(currentPage, ppe);
currentPage++;
if (currentPage <= lastPage)
ppe.HasMorePages = true;
else
currentPage = 1;
}
回复 1楼mindrayguowei的帖子
为了给你提供更优质的服务,请对本次服务进行评分。我们会认真对待你提出的宝贵意见,谢谢
http://gcdn.gcpowertools.com.cn/attachment.aspx?attachmentid=10062
页:
[1]