Print/save entire PictureBox w/ child controls

Print/save entire PictureBox w/ child controls

Post by MB » Wed, 02 Jul 2003 21:50:14



Hi,

Though I've asked this question before, I have some new
twists on this problem.

My project (which is similar to MS Paint, but with VB
controls on the drawing that can be manipulated) needs to
be able to print out the entire contents of a picturebox,
part of which may not be visible on-screen, as well as
save it as a bitmap.

Up until now, using WM_PAINT and WM_PRINT messages with
appropriate flags (ie. PRF_CHILDREN, etc.) has worked
fine.  But since then, I've added UserControls that appear
on the drawing surface that contain lightweight controls;
when using this method, the control is not painted and is
completely transparent.  Likewise, UserControls that use
picture boxes won't paint the bitmap assigned to it,
showing only the border of the picture box with the
interior transparent.

I've tried manually adding shapes and images to produce
the final image, but that won't take the Z-order into
account.

If you have any idea how to go about solving this issue, I
would greatly appreciate it.

Thanks,
MB

 
 
 

Print/save entire PictureBox w/ child controls

Post by Larry Serflate » Wed, 02 Jul 2003 22:02:57



Quote:> Though I've asked this question before, I have some new
> twists on this problem.

> Up until now, using WM_PAINT and WM_PRINT messages with
> appropriate flags (ie. PRF_CHILDREN, etc.) has worked
> fine.  But since then, I've added UserControls that appear
> on the drawing surface that contain lightweight controls;
> when using this method, the control is not painted and is
> completely transparent.
> If you have any idea how to go about solving this issue, I
> would greatly appreciate it.

Any idea?  How about creating user controls that play nice
with WM_PAINT and WM_PRINT?

You'd have to research what the actually entails, but it may
be your only recourse outside of relying on the entire area
to be viewable.

LFS

 
 
 

Print/save entire PictureBox w/ child controls

Post by MB » Thu, 03 Jul 2003 00:26:16


Thanks for the suggestion, Larry.  Unfortunately, it's
simply not possible for my purposes to create controls
that "play nice".  From a little experimenting, it seems
that a container control, such as a frame or a picture
box, will not paint its contents through these commands.  
My project relies greatly on the fact that a user control
containing a picture box is used.

Damn business specs :)

Anyway, thanks again for trying to help me out.

MB

>-----Original Message-----

>> Though I've asked this question before, I have some new
>> twists on this problem.

>> Up until now, using WM_PAINT and WM_PRINT messages with
>> appropriate flags (ie. PRF_CHILDREN, etc.) has worked
>> fine.  But since then, I've added UserControls that
appear
>> on the drawing surface that contain lightweight
controls;
>> when using this method, the control is not painted and
is
>> completely transparent.

>> If you have any idea how to go about solving this
issue, I
>> would greatly appreciate it.

>Any idea?  How about creating user controls that play nice
>with WM_PAINT and WM_PRINT?

>You'd have to research what the actually entails, but it
may
>be your only recourse outside of relying on the entire
area
>to be viewable.

>LFS

>.

 
 
 

Print/save entire PictureBox w/ child controls

Post by Larry Serflate » Thu, 03 Jul 2003 01:15:45



Quote:> Thanks for the suggestion, Larry.  Unfortunately, it's
> simply not possible for my purposes to create controls
> that "play nice".  From a little experimenting, it seems
> that a container control, such as a frame or a picture
> box, will not paint its contents through these commands.
> My project relies greatly on the fact that a user control
> containing a picture box is used.

> Damn business specs :)

How much of the picture box properties are actually using?

If you did develop a 'generic' control that knew what to do
for the paint messages, you might then turn it into a
picturebox look-alike, or a frame look-alike, and use those
for your frames and pictureboxes....

Again, outside of 'doing the right thing' for those system
messages, your other option is to grab a snapshot of the
screen image, but, that mandates that the entire area be
viewable, which you said may not be the case.

Your options are limited, you have to work within the
boundries of what is available....

LFS

 
 
 

1. How to save WMF to BMP without PictureBox Control

Hi guys,

I have a little problem with converting a WMF to a BMP in
one step. Now I do like this:

Dim pic_Picture As Picture
Set pic_Picture = Clipboard.GetData(vbCFMetafile)
Call SavePicture(pic_Picture, str_TempFilename)
frmMain.picPictureBox.Picture = LoadPicture
  (str_TempFilename)
Call SavePicture(frmMain.picPictureBox.Image,  
  str_TempFilename)

But I cant use this way over the PictureBox, cause its
gonna be an DLL without Forms & Co. I heard something
about copying the WMF to MemoryDC and then saving from
their. May someone give me a hint on that?

Thanks
Tim

2. color display problem

3. Printing a picturebox when it contains controls.

4. The definitive answer to scanning res.

5. Printing Image of all controls in picture box to 2nd picturebox

6. Perimeter of a given shape of a given color in a bitmap

7. How to print graphics in picturebox control

8. !!!!!DON'T BUY A NOKIA MONITOR!!!!!

9. Transparent Bitmaps in Child Picturebox

10. OT: saving entire websites

11. How do I get child forms to paint over mdiparent controls

12. How to save entire TreeView to Bitmap?

13. MDI children controls