|
-
Aug 15th, 2000, 08:51 AM
#1
Thread Starter
Addicted Member
Hi,
Is there a way to save a picture with text overlaid on top of it (perhaps using SavePicture)?
For Example...If I load a photo in a picture box which has a label in the corner, and in that label I display a bit of text about the photo, can I then save the photo with the text on top of it as a bitmap? (at the moment it just keeps saving the photo and not display the text!)
Any help would be appreciated
Cheers, Shaun.
-
Aug 15th, 2000, 08:57 AM
#2
First, you must draw it's Image on to it's picture. Then you can save it.
Code:
Private Sub Command1_Click()
Picture1.Picture = Picture1.Image
SavePicture Picture1.Picture, "C:\Windows\Desktop\Testing.bmp"
End Sub
-
Aug 15th, 2000, 09:05 AM
#3
Thread Starter
Addicted Member
Hi Megatron,
Sorry, but I still cant get it to work. Are there any properties that I have to set either for the picture box or the label? I currently have the labels background set to transparent to show the picture underneath the text.
Cheers,
Shaun
-
Aug 15th, 2000, 09:31 AM
#4
If you use the Print statement instead of a Label, the above example will work, however, if you want to stick with the Label, use the BitBlt API.
Make a Form and add 2 PictureBoxes, a CommandButtons and a Label. Make sure that there is a Picture loaded into Picture1 and make sure that the Label in/on top of it.
Code:
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Sub Command1_Click()
'Copy the Image to Form2
BitBlt Picture2.hDC, 0, 0, Picture1.Width, Picture1.Height, Picture1.hDC, 0, 0, vbSrcCopy
'Transfer the Image and save the Picture
Picture2.Picture = Picture2.Image
SavePicture Picture2.Picture, "C:\Windows\Desktop\Mybitmap.bmp"
End Sub
Private Sub Form_Load()
Picture2.AutoRedraw = True
End Sub
-
Aug 15th, 2000, 10:30 AM
#5
Thread Starter
Addicted Member
Cheers Megatron it works great now although I nearly posted another reply saying it didn't!! (realised I had to switch off autoredraw on picture1!)
Thanks
Shaun
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|