按钮的CLICK事件,提示出错, 就是截取这个图片控件截不准
Lparameters
lnLeft, lnTop, lnRight, lnBottom
lnTop=thisform.image4.top
&&
此行用_SCREEN.TOP+THISFORM.IMAGE4.TOP
就不出错
lnleft=thisform.image4.left
&&
lnRight=thisform.image4.width
&&
lnBottom=thisform.image4.height
&&
#Define CF_BITMAP
2
#Define SRCCOPY
13369376
Declare INTEGER GetLastError IN kernel32
Declare INTEGER GetActiveWindow IN user32
Declare INTEGER GetWindowDC IN user32 INTEGER hwnd
Declare INTEGER GetDC IN user32 INTEGER hwnd
Declare INTEGER CreateCompatibleDC IN gdi32 INTEGER hdc
Declare INTEGER DeleteDC IN gdi32 INTEGER hdc
Declare INTEGER CreateCompatibleBitmap IN gdi32 INTEGER hdc,INTEGER nWidth,INTEGER nHeight
Declare INTEGER ReleaseDC IN user32 INTEGER hwnd, INTEGER hdc
Declare INTEGER SelectObject IN gdi32 INTEGER hdc, INTEGER hObject
Declare INTEGER DeleteObject IN gdi32 INTEGER hObject
Declare INTEGER BitBlt IN gdi32 INTEGER hDestDC,INTEGER x, INTEGER y,INTEGER nWidth,;
INTEGER nHeight,INTEGER hSrcDC,INTEGER xSrc, INTEGER ySrc,INTEGER dwRop
Declare INTEGER OpenClipboard IN user32 INTEGER hwnd
Declare INTEGER CloseClipboard IN user32
Declare INTEGER EmptyClipboard
IN user32
Declare INTEGER SetClipboardData IN user32 INTEGER wFormat, INTEGER hMem
lnWidth = lnRight - lnLeft + 1
lnHeight = lnBottom - lnTop + 1
HWnd = GetActiveWindow()
*hdc = GetWindowDC (hwnd)
&&改这句会出错
hdc = GetDC (thisform.hwnd)
hVdc = CreateCompatibleDC (hdc)
hBitmap = CreateCompatibleBitmap (hdc, lnWidth, lnHeight)
= SelectObject (hVdc, hBitmap)
= BitBlt (hVdc, 0,0, lnWidth,lnHeight,;
hdc, lnLeft,lnTop, SRCCOPY)
= OpenClipboard (hwnd)
= EmptyClipboard()
lnResult = SetClipboardData (CF_BITMAP, hBitmap)
If lnResult = 0
=MESSAGEBOX('出错了!!!',0,'')
Endif
= CloseClipboard()
= DeleteObject (hBitmap)
= DeleteDC (hVdc)
= ReleaseDC (hwnd, hdc)
retu