|
I have a userform: myuserform
Here I have a image-Area
myUserForm.Image1.picture = loadImage("d:\mypic.bmp")
now I want to cut out (clip) out of this image
a rectanlge: Let's say: top-X=100 top-Y=50, Width=200, Height 150
and store it in another image2-Area in this form
I've seen a lot about BitBlt, but I have not been able to make it run:
Private Declare Function BitBlt Lib "gdi32.dll" ( _
ByVal hDestDC 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 dwRop As Long) As Long
Public Sub docrop(X, Y, w, h)
Dim Retval As Long
With myUserForm.Image2
BitBlt .Picture.hdc, X, Y, w, h, myUserForm.Image2.Picture.hdc, 0, 0, SRCCOPY
End With
End Sub
result in an object not defined. So I' not addressing correctly. But How do I?
Any other idea to clip (and save it afterwards as BMP-File)?
Martin
|