| Topic : Windows Forms Programming |
|
|
|
|
||
|
Source : http://msdn.microsoft.com
Activity:
1 comments
98 views
last activity : 07 06 2010 20:18:04 +0000
|
||
|
|
[System.Runtime.InteropServices.DllImport("gdi32.dll")]
public static extern long BitBlt (IntPtr hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, int dwRop);
private 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);
IntPtr dc1 = mygraphics.GetHdc();
IntPtr dc2 = memoryGraphics.GetHdc();
BitBlt(dc2, 0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height, dc1, 0, 0, 13369376);
mygraphics.ReleaseHdc(dc1);
memoryGraphics.ReleaseHdc(dc2);
}
private void printDocument1_PrintPage(System.Object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawImage(memoryImage, 0, 0);
}
private void printButton_Click(System.Object sender, System.EventArgs e)
{
CaptureScreen();
printDocument1.Print();
}TrackBack URL:
1 comments on "Printing the Form (Visual C#)"
Sort by:
Most Recent
Top Rated
Commented by
Samir Nigam, Sr. Software Engineer , SRM TECHSOL Pvt. Ltd.
| 07 30 2008 05:49:33 +0000
Report Abuse
Not Rated
Found the article
"Printing the Form (Visual C#)"
interesting ?
Share with your connections and communities

Post Your Resume Now !
- Create a confidential Career Profile and Resume/C.V. online
- Get advice for planning their career and for marketing of experience and skills
- Maximize awareness of and access to the best career opportunities
Viewers also viewed
|
|
|
|
|
|
Recent Knowledge (55)
|
|
|
|
Sponsored Jobs
More From Author
Why Not .... there is no rationale behind forcing someone not to do an event which is harmless instead its spreading love. |
Thanks Sumitra... and I have embeded the vid |
Its basicly coz plp see others as threat and want to be on top they do things like this so If you do your job properly and you yourself don't do politics you can get away. |