guidway
asked on
Printing a custom control
I created a user control that contains a couple of labels. I integrated the control into a project and now I need to print everything on this control (labels and an image). I've been experimenting with the graphics object but can't figure out how to print the entire control with all of its information. The most I can get to print is the bitmap background image of the control which is contained in a picture box. How do I print a custom control in .NET? thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I made a few slight modifications and was able to get your code working exactly as expected. thanks for your help!
--------------------------
Image myIm;
ScreenCapture sd = new ScreenCapture();
myIm = sd.CaptureWindow(Handle);
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(pd_P
pd.Print();
private void pd_PrintPage(object sender, PrintPageEventArgs e)
{
e.Graphics.DrawImage(myIm,
e.HasMorePages = false;
}
--------------------------
regards
prakash