Print/save entire PictureBox w/ child controls 
Author Message
 Print/save entire PictureBox w/ child controls

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



Sat, 17 Dec 2005 20:50:14 GMT  
 Print/save entire PictureBox w/ child controls

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



Sat, 17 Dec 2005 21:02:57 GMT  
 Print/save entire PictureBox w/ child controls
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

Quote:
>-----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

>.



Sat, 17 Dec 2005 23:26:16 GMT  
 Print/save entire PictureBox w/ child controls

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



Sun, 18 Dec 2005 00:15:45 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Printing entire content of picturebox

2. Printing entire content of picturebox

3. Printing entire content of picturebox

4. Saving PictureBox to file with printed text

5. Printing an entire custom control

6. Help!! Loading PictureBox FromStream and PictureBox.Image.Save

7. Printing a picture control and child controls within

8. Viewing the entire picture in a picturebox?

9. Save an image using PictureBox control?

10. Saving Pictures in PictureBox control

11. Problems saving PictureBox contents (controls and text)

12. Save an image using PictureBox control?

 

 
Powered by phpBB® Forum Software