![]() |
Bitmaps on forms
Hi
I have mislaid the bitmap used on a form. Is it possible to 'recover' the image from the form itself? Geoff |
Bitmaps on forms
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 "Geoff" wrote in message ... Hi I have mislaid the bitmap used on a form. Is it possible to 'recover' the image from the form itself? Geoff |
Bitmaps on forms
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 -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info "Geoff" wrote in message ... Hi I have mislaid the bitmap used on a form. Is it possible to 'recover' the image from the form itself? Geoff |
Bitmaps on forms
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 "Geoff" a écrit dans le message de ... Hi I have mislaid the bitmap used on a form. Is it possible to 'recover' the image from the form itself? Geoff |
Bitmaps on forms
Both Andy's and Michel's suggestions are much better than this one!
Regards, Peter T "Peter T" <peter_t@discussions wrote in message ... 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 "Geoff" wrote in message ... Hi I have mislaid the bitmap used on a form. Is it possible to 'recover' the image from the form itself? Geoff |
Bitmaps on forms
Thanks, that saved the 'day'.... and the image. <g
Geoff "Andy Pope" wrote: 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 -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info "Geoff" wrote in message ... Hi I have mislaid the bitmap used on a form. Is it possible to 'recover' the image from the form itself? Geoff |
Bitmaps on forms
Hi Michael
Neat. Thanks for that. Geoff "Michel Pierron" wrote: 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 "Geoff" a écrit dans le message de ... Hi I have mislaid the bitmap used on a form. Is it possible to 'recover' the image from the form itself? Geoff |
Bitmaps on forms
But thank you for your response as well. It did work - of course.
And both were so quick and simple to implement. Geoff "Peter T" wrote: Both Andy's and Michel's suggestions are much better than this one! Regards, Peter T "Peter T" <peter_t@discussions wrote in message ... 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 "Geoff" wrote in message ... Hi I have mislaid the bitmap used on a form. Is it possible to 'recover' the image from the form itself? Geoff |
All times are GMT +1. The time now is 07:04 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com