簡體   English   中英

圖案畫筆可以填充 win32 中的任何矩形嗎?

[英]Can a Pattern Brush fill any rectangle in win32?

好的,現在假設我有一個 Bitmap,叫做smile.bmp

然后我加載寬度為 100px高度為 100px的 bitmap 。

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.

然后我使用 Bitmap 創建了一個圖案畫筆。

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的 Bitmap。 但是現在我正在填充一個寬度和高度為200px的矩形。


所以這是我的問題,它會填充該區域,還是會拉伸像素以匹配該區域?

它將平鋪畫筆圖案以填充該區域。 文檔顯示了一個示例。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM