Turning PictureBox contents into Bitmap

Turning PictureBox contents into Bitmap

Post by MB » Thu, 29 May 2003 23:31:18



I'm developing an application, sort of like MS Paint, but
with the ability to place actual controls on the drawing
(which is a picture box).  I'm trying to then save the
contents of the drawing to a bitmap.  The drawing is
contained within a second picturebox, which is much like
the empty space in MS Paint

Here's my problem.  If part of the drawing is not shown
due to the form covering the picture, copying it's image
into a temporary picturebox(whose image will be save)
using BitBlt will copy what is visible on the screen, not
the actual contents of the picturebox itself.

Does anybody know how to save the full contents of a
picturebox that is not fully visible on screen?

 
 
 

Turning PictureBox contents into Bitmap

Post by Mike D Sutto » Thu, 29 May 2003 23:43:43


Quote:> I'm developing an application, sort of like MS Paint, but
> with the ability to place actual controls on the drawing
> (which is a picture box).  I'm trying to then save the
> contents of the drawing to a bitmap.  The drawing is
> contained within a second picturebox, which is much like
> the empty space in MS Paint

> Here's my problem.  If part of the drawing is not shown
> due to the form covering the picture, copying it's image
> into a temporary picturebox(whose image will be save)
> using BitBlt will copy what is visible on the screen, not
> the actual contents of the picturebox itself.

> Does anybody know how to save the full contents of a
> picturebox that is not fully visible on screen?

If you're drawing to the picture box then simply enabling the AutoRedraw
property will do this for you, otherwise you'll have to try sending custom
messages to the window - Have a look at this:
http://groups.google.co.uk/groups?selm=Oc0qwqzADHA.1888%40TK2MSFTNGP1...
Hope this helps,

    Mike

 - Microsoft Visual Basic MVP -

WWW: Http://www.mvps.org/EDais/

 
 
 

Turning PictureBox contents into Bitmap

Post by MB » Fri, 30 May 2003 00:16:31


Mike,

Thanks!  I used SendMessage, and it does a great job.  But
there is still one catch.  I have windowed control
contained within the picture box.  While the lightweight
controls (such as lines) worked just fine, the controls
were not copied into the image.  Any idea how to do this?

MB

Quote:>-----Original Message-----
>> I'm developing an application, sort of like MS Paint,
but
>> with the ability to place actual controls on the drawing
>> (which is a picture box).  I'm trying to then save the
>> contents of the drawing to a bitmap.  The drawing is
>> contained within a second picturebox, which is much like
>> the empty space in MS Paint

>> Here's my problem.  If part of the drawing is not shown
>> due to the form covering the picture, copying it's image
>> into a temporary picturebox(whose image will be save)
>> using BitBlt will copy what is visible on the screen,
not
>> the actual contents of the picturebox itself.

>> Does anybody know how to save the full contents of a
>> picturebox that is not fully visible on screen?

>If you're drawing to the picture box then simply enabling
the AutoRedraw
>property will do this for you, otherwise you'll have to
try sending custom
>messages to the window - Have a look at this:
>http://groups.google.co.uk/groups?selm=Oc0qwqzADHA.1888%

40TK2MSFTNGP12.phx.gbl

- Show quoted text -

>Hope this helps,

>    Mike

> - Microsoft Visual Basic MVP -

>WWW: Http://www.mvps.org/EDais/

>.

 
 
 

Turning PictureBox contents into Bitmap

Post by MB » Fri, 30 May 2003 00:35:22


Hey Mike,

Never mind my last question.  I had forgotten to include
the PRF_XXX words in the WM_PRINT call.  Everything works
perfectly now.

Thanks again,
MB

Quote:>-----Original Message-----
>> I'm developing an application, sort of like MS Paint,
but
>> with the ability to place actual controls on the drawing
>> (which is a picture box).  I'm trying to then save the
>> contents of the drawing to a bitmap.  The drawing is
>> contained within a second picturebox, which is much like
>> the empty space in MS Paint

>> Here's my problem.  If part of the drawing is not shown
>> due to the form covering the picture, copying it's image
>> into a temporary picturebox(whose image will be save)
>> using BitBlt will copy what is visible on the screen,
not
>> the actual contents of the picturebox itself.

>> Does anybody know how to save the full contents of a
>> picturebox that is not fully visible on screen?

>If you're drawing to the picture box then simply enabling
the AutoRedraw
>property will do this for you, otherwise you'll have to
try sending custom
>messages to the window - Have a look at this:
>http://groups.google.co.uk/groups?selm=Oc0qwqzADHA.1888%

40TK2MSFTNGP12.phx.gbl

- Show quoted text -

>Hope this helps,

>    Mike

> - Microsoft Visual Basic MVP -

>WWW: Http://www.mvps.org/EDais/

>.

 
 
 

1. saving the contents of a picturebox as a bitmap file

I am writing a VB app that requires the contents of a picturebox be saved as
a bitmap file.  The picturebox will contain a simple line drawing.  If
anyone has source for a simple drawing program with a file save feature,
that would help me out a lot!  Can bitblt be used to do this?  Example
please?

Thanks

Mike N

2. RGB -> HLS

3. Turning TRichText contents into a bitmap

4. .MAX(1.2)-->Direct3D needed!

5. Saving contents of PictureBox

6. Tutorial lens flare??

7. Copy the contents of a PictureBox to Clipboard

8. Learning MEL

9. Blitting the screen contents into a picturebox - problems.

10. Saving PictureBox contents as DIB

11. book animation - pages with content turning - DLL to be used from Authorware

12. Problem showing a scrolling bitmap in picturebox

13. Loading bitmap from a byte-array into a picturebox