现在假设我有一个位图,名为smile.bmp
。
HBITMAP hBitmap = (HBITMAP)LoadImage(NULL,
L"C:/MyImages/smile.bmp",
IMAGE_BITMAP,
100 /*Width of Image*/,
100 /*Height of Image*/,
LR_LOADFROMFILE);
// Loading the Bitmap with a width and height of 100px.
然后我用位图创建一个图案画笔。
HBRUSH hBrush = CreatePatternBrush(hBitmap /*The Bitmap*/);
现在,如果我用这个画笔使用FillRect
,我可以使用任何RECT
结构吗?例如,
RECT rect1 = {0, 0, 200, 200};
FillRect(hdc, &rect1, hBrush);
// Would it stretch the Bitmap or not even bother drawing it?
如果你还记得的话,我加载的位图宽度和高度分别为100px。现在我要填充一个矩形宽度和高度分别为200px.
所以这是我的问题,它会填充区域吗,或它会拉伸像素来匹配区域吗?
它将平铺画笔图案以填充该区域。文档给出了一个示例。