Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

winapi - Static Control Background Color with C++ -


i creating basic gui windows api , have run issue. starts main window opens custom background color set (rgb(230,230,230)). displays text in upper left corner static control.

settingstext = createwindow("static",                              "settings",                              ss_left | ws_child,                              12,                              20,                              100,                              20,                              hwnd,                              null,                              proginstance,                              null); showwindow(settingstext, 1); 

this works, when text displayed need way change background of match main window or else looks doesn't blend in.

my question is, how do this? use method below , works, wanted know, there way permanently set background color somehow, right after createwindow function static control without changing system colors, , have apply 1 control , not sends wm_ctlcolorstatic message. have experimented around using getdc function , setbkcolor function outside of message loop nothing works.

    case wm_ctlcolorstatic:     {     hdc hdcstatic = (hdc) wparam;     settextcolor(hdcstatic, rgb(0,0,0));     setbkcolor(hdcstatic, rgb(230,230,230));     return (int_ptr)createsolidbrush(rgb(230,230,230));     } 

i want because...

  • i don't want fill message loop functions need called every time window repaints.
  • have changes apply static control.

i thankful provided, @ least pointing me in right direction, thanks.

for static text controls there's no permanent way set text color or background. if want apply changes single static control; still have handle wm_ctlcolorstatic notification message in parent dlgproc when control drawn.

static hbrush hbrush = createsolidbrush(rgb(230,230,230));  case wm_ctlcolorstatic: {     if (settingstext == (hwnd)lparam)                //or if handle unavailable you, ctrl id      dword ctrlid = getdlgctrlid((hwnd)lparam); //window control id     if (ctrlid == idc_static1) //if desired control     {        hdc hdcstatic = (hdc) wparam;        settextcolor(hdcstatic, rgb(0,0,0));        setbkcolor(hdcstatic, rgb(230,230,230));        return (int_ptr)hbrush;     } } 

if you're looking make control's background transparent on parent dialog use setbkmode(hdcstatic, transparent).


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -