备注:最后一个参数使用的是:SRCCOPY
1、bool StretchBlt(HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc, DWORD rop);这个会进行缩放。
2、bool BitBlt(HDC hdc, int x, int y, int cx, int cy, HDC hdcSrc, int x1, int y1, DWORD rop);这个就是从指定的位置开始指定长度和宽度的复制了。
正文开始:
1、在窗体的源码.h文件中添加:
namespace JIMMY_GDI_API{
using namespace System::Runtime::InteropServices;
typedef void* HDC;
[DllImport("gdi32", EntryPoint = "StretchBlt")]
extern "C" bool StretchBlt(HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc, DWORD rop);
[DllImport("gdi32", EntryPoint = "BitBlt")]
extern "C" bool BitBlt(HDC hdc, int x, int y, int cx, int cy, HDC hdcSrc, int x1, int y1, DWORD rop);
}
2、使用示例:
#include "windows.h"
pri