Hi,
\nTo save the picture property of a picturebox you can simply use the SavePicture statement. To save an image created in a picturebox is more complex, I managed to addapt some code found in the MSDN article Q161299 to do the job. You can find this at:
\n
\n
http://support.microsoft.com/support...S&SD=msdn&FR=0\n
\nThere may be an easier way to do this but I couldn\'t find it so for what it\'s worth here is the code I use (without any error handling,so you may wish to look at that).
\n
\nTo test this create a project with a default form containing a picturebox Picture1 with SCALEMODE set to PIXELS and a command button command1. Paste this code, create some graphics at design time and hit the command1 hopefully a bitmap "test.bmp" will be created in the "C:Temp" directory.
\n
\n
\nOption Explicit
\n
\n Private Const SRCCOPY = &HCC0020 \' (DWORD) dest = source
\n
\n Private Type GUID
\n Data1 As Long
\n Data2 As Integer
\n Data3 As Integer
\n Data4(7) As Byte
\n End Type
\n
\n Private Declare Function CreateCompatibleDC Lib "gdi32" ( _
\n ByVal hdc As Long) As Long
\n Private Declare Function CreateCompatibleBitmap Lib "gdi32" ( _
\n ByVal hdc As Long, ByVal nWidth As Long, _
\n ByVal nHeight As Long) As Long
\n Private Declare Function SelectObject Lib "gdi32" ( _
\n ByVal hdc As Long, ByVal hObject As Long) As Long
\n Private Declare Function BitBlt Lib "gdi32" ( _
\n ByVal hDCDest As Long, ByVal XDest As Long, _
\n ByVal YDest As Long, ByVal nWidth As Long, _
\n ByVal nHeight As Long, ByVal hDCSrc As Long, _
\n ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) _
\n As Long
\n Private Declare Function DeleteDC Lib "gdi32" ( _
\n ByVal hdc As Long) As Long
\n Private Declare Function ReleaseDC Lib "user32" ( _
\n ByVal hwnd As Long, ByVal hdc As Long) As Long
\n Private Declare Function GetWindowDC Lib "user32" ( _
\n ByVal hwnd As Long) As Long
\n
\n Private Type picBmp
\n Size As Long
\n Type As Long
\n hBmp As Long
\n hPal As Long
\n Reserved As Long
\n End Type
\n
\n Private Declare Function OleCreatePictureIndirect _
\n Lib "olepro32.dll" (PicDesc As picBmp, RefIID As GUID, _
\n ByVal fPictureOwnsHandle As Long, IPic As IPicture) As Long
\n
\n Private Declare Function StretchBlt Lib "gdi32" _
\n (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, _
\n ByVal nWidth As Long, ByVal nHeight As Long, _
\n ByVal hSrcDC As Long, ByVal xSrc As Long, _
\n ByVal ySrc As Long, ByVal nSrcWidth As Long, _
\n ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
\n
\nPublic Function CreateBitmapPicture(ByVal hBmp As Long) As Picture
\n
\n Dim R As Long
\n Dim Pic As picBmp
\n\' IPicture requires a reference to "Standard OLE Types."
\n Dim IPic As IPicture
\n Dim IID_IDispatch As GUID
\n
\n\' Fill in with IDispatch Interface ID.
\n
\n With IID_IDispatch
\n .Data1 = &H20400
\n .Data4(0) = &HC0
\n .Data4(7) = &H46
\n End With
\n
\n\' Fill Pic with necessary parts.
\n With Pic
\n .Size = Len(Pic) \' Length of structure.
\n .Type = vbPicTypeBitmap \' Type of Picture (bitmap).
\n .hBmp = hBmp \' Handle to bitmap.
\n End With
\n
\n\' Create Picture object.
\n R = OleCreatePictureIndirect(Pic, IID_IDispatch, 1, IPic)
\n
\n\' Return the new Picture object.
\n Set CreateBitmapPicture = IPic
\n
\nEnd Function
\n
\nPublic Function exportBmp(PBox As PictureBox) As Picture
\n\'
\n Dim hDCMemory As Long
\n Dim hBmp As Long
\n Dim hBmpPrev As Long
\n Dim R As Long
\n Dim hDCSrc As Long
\n Dim hPal As Long
\n Dim hPalPrev As Long
\n Dim RasterCapsScrn As Long
\n Dim HasPaletteScrn As Long
\n Dim PaletteSizeScrn As Long
\n Dim WidthPix As Single
\n Dim HeightPix As Single
\n
\n WidthPix = PBox.ScaleWidth
\n HeightPix = PBox.ScaleHeight
\n
\n hDCSrc = GetWindowDC(PBox.hwnd) \' Get device context for pbox.
\n
\n\' Create a memory device context for the copy process.
\n hDCMemory = CreateCompatibleDC(hDCSrc)
\n\' Create a bitmap and place it in the memory DC.
\n hBmp = CreateCompatibleBitmap(hDCSrc, WidthPix, HeightPix)
\n hBmpPrev = SelectObject(hDCMemory, hBmp)
\n
\n\' Copy the on-screen image into the memory DC.
\n R = BitBlt(hDCMemory, 0, 0, WidthPix, HeightPix, hDCSrc, _
\n 0, 0, vbSrcCopy)
\n
\n\' Remove the new copy of the on-screen image.
\n hBmp = SelectObject(hDCMemory, hBmpPrev)
\n
\n\' Release the device context resources back to the system.
\n R = DeleteDC(hDCMemory)
\n R = ReleaseDC(PBox.hwnd, hDCSrc)
\n
\n\' Call CreateBitmapPicture to create a picture object from the
\n\' bitmap. Then return the resulting picture object.
\n
\n Set exportBmp = CreateBitmapPicture(hBmp)
\n
\nEnd Function
\nPrivate Sub Command1_Click()
\n\'
\n\'save as bitmap option prompts for file name
\n
\n Dim FileSpec As String
\n
\n FileSpec = "c: empTest.bmp"
\n SavePicture exportBmp(Picture1), FileSpec
\n
\nEnd Sub
\n
\nGood Luck Phil
\n
\n
\r\n \r\n\r\n