Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Do I Save The Contents Of A Picture Box? 1

Status
Not open for further replies.

MrVB50au

Programmer
Mar 16, 2003
326
AU
Hiya All,

I had just put a picturebox on a form, inside the picturebox contains an imagebox, on the imagebox I have labels 1, 2, 3 etc... when running my project I can do a lots of neat stuff, after I'm happy with what I did, I want to save the picturebox and all it's contents to a bmp file.

Can anyone please help me?

Andrew.
 
try using the savepicture command.

Search this forum and you will find plenty of explainations on how to use it.

BB
 
I have but none of them are useful. I simply want to save (infact Capture) the contents of a picturebox but I guess there's still no solution from what I've searched and read so far.

Thanks anyway,

Andrew.
 
>none of them are useful

Er...if you say so. However, from the description of what you want to do, SavePicture is exactly the solution you are looking for. If none of the (many) descriptions available in this forum of how to use it properly and effectively are appropriate, then you need to explain to us exactly how they are failing you so that we can come up with a more relvant solution to your particular problem.
 
Ok, I did the savepicture function but all it seems to be doing is saving the picturebox to a file and not the other controls I have inside the picturebox (eg: image1, labels 1, 2, 3 etc).

What am I doing wrong?

Thanks in advance,

Andrew.
 

MrVB50au have you read FAQ222-2244 item 15 yet?

See the module in thread708-428674 that I posted. It will do what you are looking for.

Good Luck

 
vb5prgrmr,

I had copied the code and saved it from Thread708-428674 and the part that interests me is the CaptureClient Function but I don't know how to use it... (dah on me). I put in a command1_click() but I don't know still how I can capture a certain part by using this and placing it into another image1 control. "I think I'm still dumb!" LOL.

Andrew.
 

have you read FAQ222-2244 item 15 yet?

Ok, wrong procedure to call...

To use this example place 2 picture boxes on a form and inside of picture1 place a command button (command1) then place on the form command2 and command3. Then with that code in a module in the project add this code to the form.
[tt]
Option Explicit

Private Sub Command2_Click()

Picture1.ScaleMode = vbPixels

Picture2.Picture = CaptureWindow(Picture1.hWnd, False, 2, 2, Picture1.ScaleWidth, Picture1.ScaleHeight)

End Sub

Private Sub Command3_Click()

Picture1.ScaleMode = vbPixels

Picture2.Picture = CaptureWindow(Picture1.hWnd, False, 0, 0, Picture1.ScaleWidth + 4, Picture1.ScaleHeight + 4)

End Sub
[/tt]

Don't Forget to read FAW222-2244.

Good Luck

 
vb5prgrmr,

That's! Is exactly what I'm looking for!

Now to let you know and others who might be interested as having trouble with getting the right format for printing.

I use Crystal Reports, Very limited in text formatting so I can now do all my formatting on screen in vb and simply pass it onto crystal reports as a mulitple of 2 across and 5 down. I may even see if I can use the saveJpg funtion I seen somehere in this forum and change the bmp file to a JPEG.

Anymore suggestion would be very muchly appriciated,

Thanks again vb5prgrmr.

Andrew.
 
>MrVB50au have you read FAQ222-2244 item 15 yet?

>have you read FAQ222-2244 item 15 yet?

Have you read that item yet? lol...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top