capturescreen

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<pre> I have used the following code for form printing. I am facing the problems.[/code]
<pre> 1. Not full form is printing[/code]
<pre> 2. How to make it is to print in landscape[/code]
<pre> 3. I want to print the full screen(including scrollable area)[/code]
<pre>4. can I see a print screen before printing?[/code]
<pre> private void printButton_Click(object sender, EventArgs e)
{
CaptureScreen();

printDocument1.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);
printDocument1.PrinterSettings.LandscapeAngle.ToString();
printDocument1.Print();
}

Bitmap memoryImage;

private void CaptureScreen()
{
Graphics myGraphics = this.CreateGraphics();
Size s = this.Size;
memoryImage = new Bitmap(s.Width, s.Height, myGraphics);
Graphics memoryGraphics = Graphics.FromImage(memoryImage);
memoryGraphics.CopyFromScreen(this.Location.X, this.Location.Y, 0, 0, s);
}

private void printDocument1_PrintPage(System.Object sender,
System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawImage(memoryImage, 0, 0);
}
[/code]
<br/>

View the full article
 
Back
Top