zabrucewayne
Sep 26th, 2002, 11:34 AM
Can anyone tell me how to copy the image of a picture box INCLUDING the images of all child picture boxes.
I have tried SendMessage with Pain/ Print which copies the picture into the destination picturebox, but this excludes all child pictureboxes. The code for this follows.
I have also tried bitblt unsucessfully as the image I want is bigger than the screen.
Any help would be appreciated!
Private Declare Function SendMessage Lib "user32" Alias _
"SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const WM_PAINT = &HF
Private Const WM_PRINT = &H317
Private Const PRF_CLIENT = &H4&
Private Const PRF_CHILDREN = &H10&
Private Const PRF_OWNED = &H20&
Private Sub Command1_Click()
Picture1.AutoRedraw = True
Picture2.AutoRedraw = True
Picture2.Width = Picture1.Width
Picture2.Height = Picture1.Height
CaptureWnd Picture1.hwnd, Picture2.hDC
Picture2.Refresh
End Sub
Private Sub CaptureWnd(inWnd As Long, outDC As Long)
SendMessage inWnd, WM_PAINT, outDC, &H0
SendMessage inWnd, WM_PRINT, outDC, _
PRF_CHILDREN + PRF_CLIENT + PRF_OWNED
End Sub
I have tried SendMessage with Pain/ Print which copies the picture into the destination picturebox, but this excludes all child pictureboxes. The code for this follows.
I have also tried bitblt unsucessfully as the image I want is bigger than the screen.
Any help would be appreciated!
Private Declare Function SendMessage Lib "user32" Alias _
"SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const WM_PAINT = &HF
Private Const WM_PRINT = &H317
Private Const PRF_CLIENT = &H4&
Private Const PRF_CHILDREN = &H10&
Private Const PRF_OWNED = &H20&
Private Sub Command1_Click()
Picture1.AutoRedraw = True
Picture2.AutoRedraw = True
Picture2.Width = Picture1.Width
Picture2.Height = Picture1.Height
CaptureWnd Picture1.hwnd, Picture2.hDC
Picture2.Refresh
End Sub
Private Sub CaptureWnd(inWnd As Long, outDC As Long)
SendMessage inWnd, WM_PAINT, outDC, &H0
SendMessage inWnd, WM_PRINT, outDC, _
PRF_CHILDREN + PRF_CLIENT + PRF_OWNED
End Sub