Click here to Skip to main content
15,936,169 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to print the windows form. Also can we print as color. And also is there option as print as pdf. If any one know please tell.
Posted

if you want to print entire form then you can use PrintForm control from Visual Basic PowerPacks toolbox.

link for same http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=25169[^]
 
Share this answer
 
v2
 
Share this answer
 
Check out the following Code :
C#
protected void btnPrint_Click(object sender, EventArgs e)
{
	PrintDocument pd = new PrintDocument();
	pd.PrintPage += new PrintPageEventHandler(GetImage);
	pd.Print();      
}
void GetImage(object o, PrintPageEventArgs e)
{
	int x = SystemInformation.WorkingArea.X;
	int y = SystemInformation.WorkingArea.Y;
	int width = this.Width;
	int height = this.Height; 
	Rectangle bounds = new Rectangle(x, y, width, height); 
	Bitmap img = new Bitmap(width, height); 
	this.DrawToBitmap(img, bounds);
	Point p = new Point(100, 100);
	e.Graphics.DrawImage(img, p);    
 }
 
Share this answer
 
Try this

C#
Bitmap bitmap = new Bitmap(this.Width, this.Height);
this.DrawToBitmap(bitmap, new Rectangle(0, 0, this.Width, this.Height));
bitmap.Save(@"YourSavePath.png", System.Drawing.Imaging.ImageFormat.Png);


EDIT: Now that I read you question again I am not sure this is what you wanted (I am not thinking clearly). :)
but I will leave it here anyway.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900