|
|
How can i set the row text color of a listview using custum Draw....
ie the row text color should be different..
thanks in advance
|
|
|
|
|
You don't know how to make your list view owner drawn OR you don't know how to set text color OR both?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
i dont know how to set text color using list view owner drawn
i know only
ListView_setTextColor that sets for whole List view..
what i m trying is to set different color on different rows text
|
|
|
|
|
I have done exactly this...
In your (MFC) NM_CUSTOMDRAW handler, you need code like this:
void whtever the clas name is::OnCustomDraw(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMLVCUSTOMDRAW pNMLVCD = reinterpret_cast<LPNMLVCUSTOMDRAW>(pNMHDR);
*pResult = CDRF_DODEFAULT;
switch(pNMLVCD->nmcd.dwDrawStage)
{
case CDDS_PREPAINT:
*pResult = CDRF_NOTIFYITEMDRAW;
break;
case CDDS_ITEMPREPAINT:
{
const COLORREF mainColor = whatever the background text colour is;
const COLORREF altColor = whatever the alternate background colour is;
const COLORREF mainTextColor = whatever the main text colour is;
const COLORREF altTextColor = whatever the alternate text colour is;
const size_t row = pNMLVCD->nmcd.dwItemSpec;
pNMLVCD->clrTextBk = (1==row%2)?altColor:mainColor;
pNMLVCD->clrText = (1==row%2)?altTextColor:mainTextColor;
*pResult = CDRF_NEWFONT;
}
break;
};
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
Error 46 error C3861: 'HANDLE_NM_CUSTOMDRAW': identifier not found
i am getting an error like this
|
|
|
|
|
Show your code. I have no idea where HANDLE_NM_CUSTOMDRAW comes from...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
do i need to add any header
for NM_CUSTOMDRAW
|
|
|
|
|
Look at the Custom Draw section in MSDN - here's a link[^]
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
yeah
i was lokking to Handle NM_CUSTOMDRAW directly
its coming in WM_NOTIFY
Thanks i m working on that
|
|
|
|
|
it never reaches in the below case statement
case CDDS_ITEMPREPAINT:
|
|
|
|
|
Do you have any items? If not, it's not going to.
The code in the CDDS_PREPAINT case block is what causes the custom draw state machine to call your handler for CDDS_ITEMPREPAINT.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
i have got around 1400 items in my ListView
its reaching inside CDDS_PREPAINT case
|
|
|
|
|
Well, add the LVS_OWNERDRAWFIXED[^] style to your list view (preferably in the resource editor if you are working with a dialog template). Then, in the parent of your list view handle the WM_DRAWITEM[^] message, this gives you a DRAWITEMSTRUCT [^] structure that contains a DC you have to use to perform the drawing, use SetTextColor[^] to set a color before you draw the texts using DrawText[^]. Hope this helps.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
See here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi,
Is there any possibility to get Geo location using IP address ?
I also searched on net but could not get the desired stuff.
|
|
|
|
|
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
yes because I did not get satishfied answer
|
|
|
|
|
So we're getting again and again your question?
Please, go building, as suggested, your own database instead.
(just kidding, man...)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Please give any suggestion, how to do it?
|
|
|
|
|
Since commercial applications and libraries uses large databases for the purpose, I suppose your effort would be a waste of energy.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Ok, please have a look on below link and guide me
<a href="http://mypath2us.com/post/2009/10/18/Get-Client-Geo-Location-in-C.aspx">http:
Is this correct way to do?
And free to use?
Any drwback to use it in my application?
|
|
|
|
|
The link you have posted has the solution, try using it.
It's time for a new signature.
|
|
|
|
|
john5632 wrote: Is this correct way to do?
That might be correct, but not very accurate (IMO).
john5632 wrote: And free to use?
It's free as long as you use, as suggested, a free webservice.
john5632 wrote: Any drwback to use it in my application?
Other than accuracy, you've to read carefully the terms of use for the webservice, I suppose.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
... and you'll probably never get it, because IP addresses are not allocated that way.
Associating an address with a place is something that can be done only at a very high level. As you go down towards the single addresses the number of exception to the general rules are much and much more.
Every multinational company that own hos own autonomous system can get addresses on one regional registry, and displace them around his world. And there is no "central authority" collection all this informations.
What commercial software do is typically recourse into the provider's whois databases until they can. The answer this way can be 90% accurate.
But the problem is that the reamin 10% is not "almost accurate" is simply completely false.
If you wan more infos try google some of the buzzwords of this post.
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|