Re: Urgent PrintPreview Error?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



"Adam Right" <adam@xxxxxxxxx> ha scritto nel messaggio
news:e5gpCV6DGHA.2872@xxxxxxxxxxxxxxxxxxxxxxx
> Hi,
>
> My code is on the below,
>

[Snip]


This works perfect to me:
class Printer {

public void Print()

{

PrintDocument m_PrintDocument = new PrintDocument();

m_PrintDocument.PrintPage += new
PrintPageEventHandler(m_PrintDocument_PrintPage);

PrintPreviewDialog printPreviewDialog1 = new PrintPreviewDialog();

printPreviewDialog1.Document = m_PrintDocument;

Form m_Temp = (Form)printPreviewDialog1;

m_Temp.WindowState = FormWindowState.Maximized;

printPreviewDialog1.ShowDialog();

}

void m_PrintDocument_PrintPage( object sender, PrintPageEventArgs e )

{

Font printFont = new Font ( "Courier" , 10 , FontStyle.Regular );

String myString = "Trying";

e.Graphics.DrawString( myString, printFont, Brushes.Black, 0, 0, new

StringFormat( ) );

}

}


--
Free .Net Reporting tool: http://www.neodatatype.net


.