
creating a bitmap pattern for a window's HBRUSH
By: a guest on Jan 28th, 2012 | syntax:
None | size: 0.76 KB | hits: 23 | expires: Never
HDC dc=GetDC(hWnd);
COLORREF backColour=GetBkColor(dc);
// do something...
ReleaseDC(dc);
COLORREF bg = GetSysColor(COLOR_BTNFACE);
bg = RGB(GetBValue(bg), GetGValue(bg), GetRValue(bg));
COLORREF fg = bg - 0x00151515; //slightly darker than the background color
COLORREF bits[30] = { //would be problematic I guess if the color
bg, bg, bg, bg, fg, //was originally less than 0x00151515
bg, bg, bg, fg, bg,
bg, bg, fg, bg, bg,
bg, fg, bg, bg, bg,
fg, bg, bg, bg, bg
};
HBITMAP hbm = CreateBitmap(5, 5, 1, sizeof(COLORREF) * 8, bits);
hbr = CreatePatternBrush(hbm);
HBRUSH main_st_color_ev(HWND hwnd, HDC hdc, HWND hwndChild, int type){
return stripes;
}
SetBkMode(hdc, TRANSPARENT);