Thursday, 15 January 2015

winapi - C++ Button with transparent background -



winapi - C++ Button with transparent background -

i'm creating basic application in c++ (win32 api). tried create button createwindow() function seen below:

button1 = createwindow("button", text("click me!"), ws_tabstop | ws_child | ws_visible | bs_pushbutton, 100, 200, 70, 25, hwnd, (hmenu)null, null, null);

the problem there white border around button can see here: link

i tried create transparent code doesn't work.

case wm_ctlcolorbtn:{ hbrush hbrushbtn; hbrushbtn = (hbrush)getstockobject(null_brush); setbkmode((hdc) wparam, transparent); homecoming ((lresult)hbrushbtn); break; }

how can this?

thanks

setbkmode() affects whether or not text rendering transparent or not, not issue here.

you're going have wm_printclient parent command button's dc, as demonstrate here. (note code still calls setbkmode() transparent text in checkboxes, groupboxes, labels, etc.; pushbuttons won't matter if you're using visual styles).

c++ winapi button

No comments:

Post a Comment