visual studio 2013 - How to create transparent Rectangle in Mfc c++? -
i want create rectangle total transparent try code. idea how that?
bool chtmldlgtestdlg::pretranslatemessage(msg* pmsg) { if (pmsg->message == wm_mousemove && (pmsg->wparam & mk_lbutton)) { cpoint p = pmsg->pt; screentoclient(&p); crect r(10, 15, 380, 50); cdc* pcdc = getdc(); pcdc->rectangle(r); cbrush brush; brush.createsolidbrush(rgb(255, 255, 0)); pcdc->fillrect(&r, &brush); if (r.ptinrect(p)) { releasecapture(); sendmessage(wm_nclbuttondown, htcaption, 0); sendmessage(wm_nclbuttonup, htcaption, 0); return 1; } } return cdhtmldialog::pretranslatemessage(pmsg); }
this mfc c++ code example.
first: how hell want create transparent rectangle, if created solid brush , after did fillrect it?
if wanted using brush, have go 1 "that not paints anything" like:
brush.createstockobject(null_brush);
may wanted rectangle opaque border , transparent interior. in case, in addition null brush, object need create cpen.
cpen p(ps_solid, 0, rgb(255, 255, 0)); pcdc->selectobject(&p); pcdc->rectangle(r);
secondly, think drawedge
function simplest way go if dont' care border color (the colors fixed; search drawedge in google images see mean).
Comments
Post a Comment