Bitmaps on forms

  • Thread starter Thread starter Geoff
  • Start date Start date
G

Geoff

Hi
I have mislaid the bitmap used on a form. Is it possible to 'recover' the
image from the form itself?

Geoff
 
Well that was careless wasn't it !

Drag your form into a new project, remove all controls, PictureSizeMode=0,
size the form to at least the size of the picture, maybe change
PictureAlignment. You've probably got some image app that has a screen
capture facility. If not try this in the form.

Private Declare Sub keybd_event Lib "user32" ( _
ByVal bVk As Byte, _
ByVal bScan As Byte, _
ByVal dwFlags As Long, _
ByVal dwExtraInfo As Long)
Const VK_SNAPSHOT = 44 ' &H2C
Const VK_LMENU = 164
Const KEYEVENTF_KEYUP = 2
Const KEYEVENTF_EXTENDEDKEY = 1

Private Sub UserForm_Click()
DoEvents
keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY, 0 ' key down
keybd_event VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY, 0
keybd_event VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0
keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0
DoEvents
MsgBox "Form image in Clipboard"
End Sub

Paste into an image processor that can crop the bmp from the image of the
form, I use IrfanView.com

Regards,
Peter T
 
Hi,

In the Properties window go to the Picture property of the control that
contains the image.
CTRL+C to copy the image.
Now paste the image into Paint or some other graphics package that will
allow you to save the image.

Cheers
Andy
 
Hi Geoff,
With a button on the userform:

Private Sub CommandButton1_Click()
Select Case Me.Picture.Type
Case 1: SavePicture Me.Picture, "c:\SaveImg.bmp"
Case 2, 4: SavePicture Me.Picture, "c:\SaveImg.wmf"
End Select
End Sub
 
Both Andy's and Michel's suggestions are much better than this one!

Regards,
Peter T
 
Hi Michael
Neat. Thanks for that.

Geoff

Michel Pierron said:
Hi Geoff,
With a button on the userform:

Private Sub CommandButton1_Click()
Select Case Me.Picture.Type
Case 1: SavePicture Me.Picture, "c:\SaveImg.bmp"
Case 2, 4: SavePicture Me.Picture, "c:\SaveImg.wmf"
End Select
End Sub
 
But thank you for your response as well. It did work - of course.

And both were so quick and simple to implement.

Geoff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top