Hola nuevamente, segun entiendo tu deseo es imprimir un control con sus controles y pode establecer un zoom, ademas y o tambien poder obtener una imagen para guardarla en disco.
bien esta funcion te va a servir.
pega esto en un modulo, o en el formulario si lo prefieres.
Option Explicit
Private Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(7) As Byte
End Type
Private Type PicBmp
Size As Long
Type As Long
hBmp As Long
hPal As Long
Reserved As Long
End Type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function GetDC Lib "user32.dll" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32.dll" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function PrintWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal hdcBlt As Long, ByVal nFlags As Long) As Long
Private Declare Function OleCreatePictureIndirect Lib "olepro32.dll" (PicDesc As PicBmp, RefIID As GUID, ByVal fPictureOwnsHandle As Long, IPic As IPicture) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function GetWindowRect Lib "user32.dll" (ByVal hwnd As Long, ByRef lpRect As RECT) As Long
Private Declare Function SetStretchBltMode Lib "gdi32.dll" (ByVal hdc As Long, ByVal nStretchMode As Long) As Long
Private Declare Function StretchBlt Lib "gdi32.dll" (ByVal hdc 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 nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
Private Declare Function DeleteObject Lib "gdi32.dll" (ByVal hObject As Long) As Long
Function GetPictureControl(oControl As Object, Zoom As Integer) As Picture
Dim hdc As Long
Dim hDCMemory As Long, hBmp As Long, hBmpPrev As Long
Dim hDCMemory2 As Long, hBmp2 As Long, hBmpPrev2 As Long
Dim tRect As RECT
Dim lWidth As Long, lHeight As Long
Dim NewWidth As Long, NewHeight As Long
Dim Pic As PicBmp, IPic As IPicture, IID_IDispatch As GUID
GetWindowRect oControl.hwnd, tRect
lWidth = tRect.Right - tRect.Left
lHeight = tRect.Bottom - tRect.Top
hdc = GetDC(0)
hDCMemory = CreateCompatibleDC(0)
hBmp = CreateCompatibleBitmap(hdc, lWidth, lHeight)
hBmpPrev = SelectObject(hDCMemory, hBmp)
PrintWindow oControl.hwnd, hDCMemory, 0
NewWidth = (lWidth * Zoom / 100)
NewHeight = (lHeight * Zoom / 100)
hDCMemory2 = CreateCompatibleDC(0)
hBmp2 = CreateCompatibleBitmap(hdc, NewWidth, NewHeight)
hBmpPrev2 = SelectObject(hDCMemory2, hBmp2)
SetStretchBltMode hDCMemory2, vbPaletteModeNone
StretchBlt hDCMemory2, 0, 0, NewWidth, NewHeight, hDCMemory, 0, 0, lWidth, lHeight, vbSrcCopy
ReleaseDC 0, hdc
DeleteObject SelectObject(hDCMemory, hBmpPrev)
Call DeleteDC(hDCMemory)
Call SelectObject(hDCMemory2, hBmpPrev2)
Call DeleteDC(hDCMemory2)
With IID_IDispatch
.Data1 = &H20400
.Data4(0) = &HC0
.Data4(7) = &H46
End With
With Pic
.Size = Len(Pic)
.Type = vbPicTypeBitmap
.hBmp = hBmp2
End With
Call OleCreatePictureIndirect(Pic, IID_IDispatch, 1, IPic)
Set GetPictureControl = IPic
End Function
y luego por ejemplo si queres imprimir el contenido de picture1 o obtener la imagen con zoom
Private Sub Command1_Click()
Me.Picture = GetPictureControl(Picture1, 150)
End Sub
Private Sub Command2_Click()
Printer.PaintPicture GetPictureControl(Picture1, 200), 0, 0
Printer.EndDoc
End Sub