winapi - C++ Win32 Draw to a DC and Keeping It -
i trying draw simple few rectangles , store result, need draw once. so, keeping hdc (hdcbackround) @ top "globaly."
void drawbackground(hwnd hwnd) { // hwnd main windows handle // dimensions rect rect; getwindowrect(hwnd, &rect); hdc hwindc = getdc(hwnd); hdcbackground = ::createcompatibledc(hwindc); // "global" hbitmap hbm = ::createcompatiblebitmap(hwindc, rect.right, rect.bottom); ::selectobject(hdcbackground, hbm); setbkmode(hdcbackground, transparent); selectobject(hdcbackground, hfont[hf_default]); selectobject(hdcbackground, hbrush[hb_topbg]); selectobject(hdcbackground, hpen[hp_thinborder]); // draw rectangle(hdcbackground, 0, 0, rect.right, 20); selectobject(hdcbackground, hbrush[hb_lowbg]); rectangle(hdcbackground, 50, 20, rect.right, 40); // ??? clean after works releasedc(hwnd, hwindc); }
i call function once, , in timer bitblt() hdcbackground screens hdc. when test out, draws both rectangles, 1px border (as pen set as,) there no color, black , white.
the brushes , such fine, not getting color. rgb on brushes (25,25,25) , (65,65,65), dark grey.
any ideas? thanks.
Comments
Post a Comment