hi i want to color the cell of list control
-
hi all i have five list control in report mode on my single dialog when i click one and go to second,third,fourth and five by clicking the cell of list control i want to change the color of cell of list control only where i click the particular cell of list controls, how can i do this,reply please i will be so greatful thank u in advance malik
-
hi all i have five list control in report mode on my single dialog when i click one and go to second,third,fourth and five by clicking the cell of list control i want to change the color of cell of list control only where i click the particular cell of list controls, how can i do this,reply please i will be so greatful thank u in advance malik
Anything in Windows that there's not a documented interface for, you can usually accomplish through Windows subclassing. In your case, to sketch out a solution, you would subclass the list control window, and then handle in all liklihood WM_PAINT. On that message, you would send LVM_GETITEMRECT to the list control window, and get the bounding rect of the list control cell you were interested in. Then just BitBlt whatever color you want to the hdc of the window, using the dimensions of the rect you retrieved (possibly using PATBLT for a ROP code, first setting the hdc brush to the appropriate color.) So that's the basic idea. Actually, although I'm not sure I entirely understood you, the above solution might not work if you BitBlt to the cell and then the original WinProc writes text over it, as the textbackground color may be wrong, unless its being drawn transparent. Of course, there's SetBkMode to make the text background transparent, but I don't know how you get this to work for the hdc the original WndProc is writing to. It looks like you've got some work to do on your own, but its certainly not impossible. Also there's LVM_SETTEXTBKCOLOR, FWIW. -- modified at 11:09 Thursday 25th October, 2007
-
hi all i have five list control in report mode on my single dialog when i click one and go to second,third,fourth and five by clicking the cell of list control i want to change the color of cell of list control only where i click the particular cell of list controls, how can i do this,reply please i will be so greatful thank u in advance malik
LVS_OWNERDRAWFIXED the list-view control sends a WM_DRAWITEM message to paint eachitem
-
hi all i have five list control in report mode on my single dialog when i click one and go to second,third,fourth and five by clicking the cell of list control i want to change the color of cell of list control only where i click the particular cell of list controls, how can i do this,reply please i will be so greatful thank u in advance malik
If you mean with color the item-selection and that only the current listtrl has a selection... you can play with the
KillFocus
to unselect the item/subitem when changing of ListCtrl. You should have no colors on any unselected ListCtrl.Greetings. -------- M.D.V. If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you ;)
-
If you mean with color the item-selection and that only the current listtrl has a selection... you can play with the
KillFocus
to unselect the item/subitem when changing of ListCtrl. You should have no colors on any unselected ListCtrl.Greetings. -------- M.D.V. If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you ;)
please give some more light on your approach because i am new to mfc malik
-
LVS_OWNERDRAWFIXED the list-view control sends a WM_DRAWITEM message to paint eachitem
please give some light on your approach because i am new for mfc malik
-
please give some light on your approach because i am new for mfc malik
do an article search for lvs_ownerdrawfixed. there are two that look particularly interesting to solve your dilemma, one by Muhammad Azam[^] and one by Piotr Szewczyk[^]