本文整理汇总了C#中System.Windows.Forms.PrintPreviewDialog.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# PrintPreviewDialog.Dispose方法的具体用法?C# PrintPreviewDialog.Dispose怎么用?C# PrintPreviewDialog.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.PrintPreviewDialog
的用法示例。
在下文中一共展示了PrintPreviewDialog.Dispose方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: button2_Click
private void button2_Click(object sender, System.EventArgs e)
{
pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
pd.PrinterSettings.PrinterName = "PDFCreator";
pd.DocumentName = "PDFCreator Dot Net - Sample2";
PrintPreviewDialog ppdlg = new PrintPreviewDialog();
ppdlg.Document = pd;
ppdlg.WindowState = FormWindowState.Maximized;
ppdlg.ShowDialog();
ppdlg.Dispose();
}
示例2: Run
public override void Run(Altaxo.Graph.GUI.GraphController ctrl)
{
try
{
System.Windows.Forms.PrintPreviewDialog dlg = new System.Windows.Forms.PrintPreviewDialog();
Current.PrintingService.PrintDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(ctrl.EhPrintPage);
dlg.Document = Current.PrintingService.PrintDocument;
dlg.ShowDialog(ctrl.View.Form);
dlg.Dispose();
}
catch(Exception ex)
{
System.Windows.Forms.MessageBox.Show(ctrl.View.Form,ex.ToString());
}
finally
{
Current.PrintingService.PrintDocument.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(ctrl.EhPrintPage);
}
}
示例3: dataGridView_print
public void dataGridView_print()
{
PrintPreviewDialog ppvw = new PrintPreviewDialog();
ppvw.Document = myDocument;
//GetPageSum();
//ppvw.ShowDialog();·
myDocument.BeginPrint += new PrintEventHandler(myDocument_BeginPrint);
myDocument.PrintPage += new PrintPageEventHandler(myDocument_PrintPage);
if (ppvw.ShowDialog() == DialogResult.OK)
{
myDocument.Print();
}
else
{
myDocument.BeginPrint -= new PrintEventHandler(myDocument_BeginPrint);
myDocument.PrintPage -= new PrintPageEventHandler(myDocument_PrintPage);
ppvw.Dispose();
return;
}
myDocument.BeginPrint -= new PrintEventHandler(myDocument_BeginPrint);
myDocument.PrintPage -= new PrintPageEventHandler(myDocument_PrintPage);
}
示例4: ShowPrintPreviewDialog
public override bool ShowPrintPreviewDialog(PrintPageEventHandler printPageEventHandler, QueryPageSettingsEventHandler queryPageSettingsEventHandler)
{
try
{
System.Windows.Forms.PrintPreviewDialog dlg = new System.Windows.Forms.PrintPreviewDialog();
Current.PrintingService.PrintDocument.PrintPage += printPageEventHandler;
Current.PrintingService.PrintDocument.QueryPageSettings += queryPageSettingsEventHandler;
dlg.Document = Current.PrintingService.PrintDocument;
dlg.ShowDialog(MainWindow);
dlg.Dispose();
return true;
}
catch (Exception ex)
{
Current.Gui.ErrorMessageBox(ex.ToString());
}
finally
{
Current.PrintingService.PrintDocument.PrintPage -= printPageEventHandler;
Current.PrintingService.PrintDocument.QueryPageSettings -= queryPageSettingsEventHandler;
}
return false;
}
示例5: EhMenuFilePrintPreview_OnClick
/// <summary>
/// Handler for the menu item "File" - "Print Preview".
/// </summary>
/// <param name="sender">Not used.</param>
/// <param name="e">Not used.</param>
private void EhMenuFilePrintPreview_OnClick(object sender, System.EventArgs e)
{
try
{
System.Windows.Forms.PrintPreviewDialog dlg = new System.Windows.Forms.PrintPreviewDialog();
Current.PrintingService.PrintDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.EhPrintPage);
dlg.Document = Current.PrintingService.PrintDocument;
dlg.ShowDialog(this.m_View.Window);
dlg.Dispose();
}
catch(Exception ex)
{
System.Windows.Forms.MessageBox.Show(this.m_View.Window,ex.ToString());
}
finally
{
Current.PrintingService.PrintDocument.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(this.EhPrintPage);
}
}
示例6: PrintOrPreview
public void PrintOrPreview(CharsPerLine CPL,
string PPrintBlock, string PTitle,
string PSubTitle, PrintPreview PVOption,
PrintOrientation Layout,string ColHdr1,string ColHdr2,
string ColHdr3,string ColHdr4)
{
PrintPreviewDialog previewDialog;
tbm = new TBMemoLine();
Portrait =(Layout==PrintOrientation.Portrait);
msRptString=PPrintBlock;
_Title = PTitle;
_SubTitle=PSubTitle;
SetUpColHdrArray(ColHdr1,ColHdr2,ColHdr3,ColHdr4);
miChrPerLine=(int) CPL;
// create two memoline objects so that we can use
// nested calls to memoline w/o stepping
// on each other, used only when wordwrap is on
if (sFooter.Length == 0)
{
sFooter = "Printed on: " + DateTime.Now.ToString();
}
// chars per line will vary based on the margins
switch (CPL)
{
case CharsPerLine.CPL80:
DetailFontSize = DETAIL_FONT_SIZE_80;
break;
case CharsPerLine.CPL96:
DetailFontSize = DETAIL_FONT_SIZE_96;
break;
case CharsPerLine.CPL120:
DetailFontSize = DETAIL_FONT_SIZE_120;
break;
case CharsPerLine.CPL160:
DetailFontSize = DETAIL_FONT_SIZE_160;
break;
default:
throw new System.Exception("Invalid CharsPerLine parameter");
}
// set up memoline
miNL = tbm.MLCount(msRptString);
if(miNL==0)
{
MessageBox.Show("No lines to print in report string.");
return;
}
mI=0;
PrintDoc = new PrintDocument();
PrintDoc.PrintPage += new PrintPageEventHandler(this.OnPrintPage);
PrintDoc.DefaultPageSettings.Landscape=(Layout == PrintOrientation.Landscape);
PrintDoc.DocumentName=_Title;
if(PVOption == PrintPreview.Preview)
{
previewDialog = new PrintPreviewDialog();
previewDialog.Document = PrintDoc;
previewDialog.ShowDialog();
previewDialog.Dispose();
}
else
PrintDoc.Print();
}
示例7: PrintPreview
// Do a print preview of the descriptions.
public void PrintPreview(Size dialogSize)
{
// Set up and position everything.
SetupPrinting();
printPreviewInProgress = true;
using (PrintDocument printDocument = CreatePrintDocument()) {
PrintPreviewDialog dialog = new PrintPreviewDialog();
dialog.UseAntiAlias = true;
dialog.Document = printDocument;
dialog.StartPosition = FormStartPosition.CenterParent;
dialog.Size = dialogSize;
dialog.SizeGripStyle = SizeGripStyle.Show;
dialog.ShowIcon = false;
// Remove the "print" button.
foreach (Control ctl in dialog.Controls) {
ToolStrip strip = ctl as ToolStrip;
if (strip != null) {
var button = strip.Items[0];
if (button.Name == "printToolStripButton")
strip.Items.Remove(button);
}
}
dialog.ShowDialog();
dialog.Dispose();
}
}
示例8: PrinterSetting
public void PrinterSetting()
{
PrintDialog pDlg = new PrintDialog();
PrintPreviewDialog ppDlg = new PrintPreviewDialog();
try
{
//��������ֵ��PrinterSettings
PrinterSettings ps = new PrinterSettings();
//����ѡ��ҳ
pDlg.AllowSomePages = true;
//ָ����ӡ�ĵ�
pDlg.Document = document;
//��ʾ�Ի���
DialogResult result = pDlg.ShowDialog();
if (result == DialogResult.OK)
{
//�����ӡ����
ps = pDlg.PrinterSettings;
ppDlg.Text = "��ӡԤ��";
ppDlg.WindowState = FormWindowState.Maximized;
ppDlg.PrintPreviewControl.Zoom = 1;
//ָ����ӡ�ĵ�
ppDlg.Document = document;
ppDlg.ShowDialog();
}
}
catch (System.Drawing.Printing.InvalidPrinterException e)
{
MessageBox.Show("�����ڿ��������Ӵ�ӡ��!", "δ�ҵ���ӡ��");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "��ӡ����");
}
finally
{
pDlg.Dispose();
pDlg = null;
ppDlg.Dispose();
ppDlg = null;
}
}
示例9: Preview
public void Preview()
{
PrintPreviewDialog ppDlg = new PrintPreviewDialog();
try
{
ppDlg.Text = "��ӡԤ��";
ppDlg.WindowState = FormWindowState.Maximized;
ppDlg.PrintPreviewControl.Zoom = 1;
//ָ����ӡ�ĵ�
ppDlg.Document = document;
//��ʾ�Ի���
// ppDlg.FindForm().Visible = false;
DialogResult result = ppDlg.ShowDialog();
// ppDlg.FindForm().Visible = true;
if (result == DialogResult.OK)
{
//...
}
}
catch (System.Drawing.Printing.InvalidPrinterException e)
{
MessageBox.Show("�����ڿ��������Ӵ�ӡ��!", "δ�ҵ���ӡ��");
//ShowInvalidPrinterException(e);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "��ӡ����");
}
finally
{
ppDlg.Dispose();
ppDlg = null;
}
}