PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Print problem
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Print problem
![]() |
Print problem |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
I have a PictureBox on a form. I have set up a print routine to send the
image to a printer, basically copied out of Help, with a 'e.Graphics.DrawImageUnscaled(PictureBox1.Image, 0, 0)' call in the PrintPage event handler. The image prints ok. One complication. This particular picturebox has a number of custom controls sitting on it with the picture box defined as their parent. They are not showing up in the print. How do I include them? |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Hi,
this is kinda difficult to do. I recently built a similar application, using an image as a map and pins on them which were controls. You will have to manually paint the controls onto the Graphics object passed to you in the event arguments. This is difficult because you need to take scaling and such into account. You can add a Print method to your custom controls from the Print method you can then call OnPaint using a PaintEventArgs constructed by hand. I do not know for sure if this will work for the default WinForms controls Grtz, Wouter van Vugt http://blogs.infosupport.com/wouterv |
|
|
|
#3 |
|
Guest
Posts: n/a
|
I kind of suspected that. I'll just have to experiment.
Thanks! "woutervu@hotmail.com" wrote: > Hi, > > this is kinda difficult to do. I recently built a similar application, > using an image as a map and pins on them which were controls. You will > have to manually paint the controls onto the Graphics object passed to > you in the event arguments. This is difficult because you need to take > scaling and such into account. You can add a Print method to your > custom controls from the Print method you can then call OnPaint using a > PaintEventArgs constructed by hand. I do not know for sure if this will > work for the default WinForms controls > > Grtz, Wouter van Vugt > http://blogs.infosupport.com/wouterv > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
Try using the PrintWindow method to print directly to a bitmap. You may find
this works but I suspect that the controls on top of the picturebox are siblings of the PB rather than children. Am I right? If this is the case you may have to make all the controls children of a Panel and call PrintWindow with the Panel's window handle. -- Bob Powell [MVP] Visual C#, System.Drawing Ramuseco Limited .NET consulting http://www.ramuseco.com Find great Windows Forms articles in Windows Forms Tips and Tricks http://www.bobpowell.net/tipstricks.htm Answer those GDI+ questions with the GDI+ FAQ http://www.bobpowell.net/faqmain.htm All new articles provide code in C# and VB.NET. Subscribe to the RSS feeds provided and never miss a new article. "B. Chernick" <BChernick@discussions.microsoft.com> wrote in message news:A5F9F02C-9F95-48E9-BC5A-D74613079027@microsoft.com... >I have a PictureBox on a form. I have set up a print routine to send the > image to a printer, basically copied out of Help, with a > 'e.Graphics.DrawImageUnscaled(PictureBox1.Image, 0, 0)' call in the > PrintPage event handler. The image prints ok. > > One complication. This particular picturebox has a number of custom > controls sitting on it with the picture box defined as their parent. They > are not showing up in the print. How do I include them? > |
|
|
|
#5 |
|
Guest
Posts: n/a
|
Actually no. The Parent property of every control is set to the picturebox.
"Bob Powell [MVP]" wrote: > Try using the PrintWindow method to print directly to a bitmap. You may find > this works but I suspect that the controls on top of the picturebox are > siblings of the PB rather than children. Am I right? > > If this is the case you may have to make all the controls children of a > Panel and call PrintWindow with the Panel's window handle. > > -- > Bob Powell [MVP] > Visual C#, System.Drawing > > Ramuseco Limited .NET consulting > http://www.ramuseco.com > > Find great Windows Forms articles in Windows Forms Tips and Tricks > http://www.bobpowell.net/tipstricks.htm > > Answer those GDI+ questions with the GDI+ FAQ > http://www.bobpowell.net/faqmain.htm > > All new articles provide code in C# and VB.NET. > Subscribe to the RSS feeds provided and never miss a new article. > > > > > > "B. Chernick" <BChernick@discussions.microsoft.com> wrote in message > news:A5F9F02C-9F95-48E9-BC5A-D74613079027@microsoft.com... > >I have a PictureBox on a form. I have set up a print routine to send the > > image to a printer, basically copied out of Help, with a > > 'e.Graphics.DrawImageUnscaled(PictureBox1.Image, 0, 0)' call in the > > PrintPage event handler. The image prints ok. > > > > One complication. This particular picturebox has a number of custom > > controls sitting on it with the picture box defined as their parent. They > > are not showing up in the print. How do I include them? > > > > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

