|
I try to subclass and use this code for change background color in list control
<br />
BOOL CSubListCtrl::OnEraseBkgnd(CDC* pDC) <br />
{<br />
CRect rect;<br />
GetClientRect(&rect);<br />
pDC->FillSolidRect(0,0,rect.Width(),rect.Height(),RGB(100,200,0));<br />
return TRUE;<br />
}
it work only when first time show.
but when I add item to it, that item will change to default color.
Please help me for solve this problem.
|
|
|
|
|
I think you should override DrawItem which will be called when each item of the control is to be drawn. Then use the input parameter for that function(lpDrawItemStruct ) like this:
CDC dc;
dc.Attach(lpDrawItemStruct->hDC);
dc.FillSolidRect(&lpDrawItemStruct->rcItem, RGB(100,200,0));
dc.Detach();
You should also manually draw text of each item, check to see if it is selected to highlight it and draw a border for active item.
By the way if your list control is inside a dialog, take a look at OnCtlColor of the dialog. It makes life times easier if you just need to change background or text color of a dialog control.
-- modified at 6:59 Wednesday 3rd October, 2007
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
I wonder why you do such a thing when SetBkColor and SetTextBkColor are available for CListCtrl.
- NS -
|
|
|
|
|
|
But he needs a single bk color. So my suggestion is good, right?
- NS -
|
|
|
|
|
I didnt see your answer but I see your answer yeah its good and perfect.;) but he must tells more detaily of his control.
|
|
|
|
|
scanf consider space bar as an end of input just like an enter key(carriage return), is it possible so that it shouldn't consider space bar as an end of input.
|
|
|
|
|
does this works for you
char vl_sData1[111],vl_sData[1233];
sprintf(sData,"Hello World\n")
sscanf(sData,"%[^\n]" , vl_sData1)
|
|
|
|
|
You are only partialy correct. When scanf() is processing a %s format specifier, it will continue until it encounters a whitespace character. If there are any more format specifiers, those will then get processed.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Use gets() function.
It will scan the string till you will press enter key.
|
|
|
|
|
Hi,
how does "sizeof" operator works internally?
Thanks
-Sachin
|
|
|
|
|
Did you try a simple Google search[^]?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->ßRÅhmmÃ<-·´¯`·.
|
|
|
|
|
I tried that also, but didn't get any solution.
-Sachin
|
|
|
|
|
Sachinpatole wrote: I tried that also, but didn't get any solution.
You are lying...
- NS -
|
|
|
|
|
Sachinpatole wrote: I tried that also, but didn't get any solution.
So google is not your friend.;)
|
|
|
|
|
The compiler "knows" the sizes of all types that are native, or have been declared up to that point. It merely substitutes an integer constant in place of the sizeof expression at compile-time. Unless you're talking about reflection or RTTI (run-time type identification), all the size information is known at compile time, so there is no run-time involvement; just a simple substitution. Much like using a #define or a const.
Hope this helps.
David
|
|
|
|
|
I do not know a way to get all exceptions.
try
{
}
catch(CException *e){}
is not working for all exceptions. If I put catch(...) it is ok but I cannot get the error message this way.
Do you know what I can put in the catch () so that I can handle all exceptions having their messages.
Thank you!
modified 8-Mar-17 3:46am.
|
|
|
|
|
In order to catch everything, you need to look at the docs for the function which is throwing the exception and then add a catch statement specific for that.
try<br />
{<br />
}<br />
catch(CException *e)<br />
{<br />
}<br />
catch(LPTSTR szErr)<br />
{<br />
}<br />
catch(...)<br />
{<br />
}
Waldermort
|
|
|
|
|
Have u tried using
"try-finally-statements"
-Sachin
|
|
|
|
|
Exactly how does that get the text of the exception being thrown?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Im not sure but I think some times ago I saw a code on the http://www.koders.com about get exceptions see this site.
|
|
|
|
|
I'm trying to enable the SE_TCB_NAME privilage within the token of my process, but for some reason after the call to AdjustTokenPrivilages() GetLastError returns ERROR_NOT_ALL_ASSIGNED. My program is running in elevated mode so I can't understand why I am unable to set this.
Is there something I am missing?
Waldermort
|
|
|
|
|
The AdjustTokenPrivileges function cannot add new privileges to the access token. It can only enable or disable the token's existing privileges. To determine the token's privileges, call the GetTokenInformation function.
-Sachin
|
|
|
|
|
in some of the source codes, i came across defining a function like this.
int function(int a,...);
can any body explain me the significance and use of the above convention?
thanks.
-- modified at 3:39 Wednesday 3rd October, 2007
|
|
|
|
|
See here[^]. Basically it's used to define a function which takes a variable amount of arguments.
Steve
|
|
|
|