hello :bg
how can i make a listview (in the details view) with diffrent background colors in each line ?
ie, for example the first line has the backround color ==RED,the second line with background color ==BLUE,and so on...
the same question but columns in place of lines,
thank you in advance :U
this will do it but you will need to play with the hex numbers to get your colors..
  cmp uMsg, WM_NOTIFY
  jne @F
   push edi
   mov edi,lParam
   assume edi:ptr NMHDR
   mov eax,[edi].hwndFrom
   .if eax==hList Â
    .if [edi].code == NM_CUSTOMDRAW
     mov ecx,edi
     ASSUME ecx:ptr NMLVCUSTOMDRAW
     .if [ecx].nmcd.dwDrawStage == CDDS_PREPAINT
      mov eax,CDRF_NOTIFYITEMDRAW
      ret
     .elseif [ecx].nmcd.dwDrawStage == CDDS_ITEMPREPAINT
      mov eax, [ecx].nmcd.dwItemSpec
      and eax, 1
      dec eax
      and eax, (00C5C5C5h - 00D6D8D3h)
      add eax, 00787878h
      mov [ecx].clrTextBk, eax
      mov eax, CDRF_NEWFONT
      ret
      ASSUME ecx:nothing
     .endif
    .endif
   .endif
   pop edi
Jackal ,thank you for the help :U
hi Jackal,
your code can change the color of items,but how to change the color of a specific column?or is it possible?
I have not looked at his code but when drawing the text into the listview you have to have the bounding rect of each column so you can paint individual backgrounds then. The attached example paints the columns separate colors when a line is selected...
Note that this is written for RadASM and in GoAsm syntax, you will need my headers to compile it, they are available from my website. Don't bother asking to translate it, I don't have MASM available nor am I likely to download it.
Donkey
[attachment deleted by admin]
i understood the question as being the way he gave an example of.
Quote from: Jackal on January 01, 2008, 11:54:01 PM
i understood the question as being the way he gave an example of.
Hi Jackal,
No problem with your code at all, the question wasn't clear. I just modified an old listview example I did a few years back to paint the columns separately.
Edgar
Article at CodeProject: Neat Stuff to Do in List Controls Using Custom Draw (http://www.codeproject.com/KB/combobox/lvcustomdraw.aspx)
hi
i have problems with draw color to my listview i uses Jackal source
can your help me please
greets
ragdog
[attachment deleted by admin]
I dont believe you are ever getting the message CDDS_ITEMPREPAINT. It does get CDDS_PREPAINT however and works down to that point.
I have been to this forum to ask for a color listview I do not in my app
I have something in the resource change?
http://www.masm32.com/board/index.php?action=dlattach;topic=7858.0;id=4151
ragdog
[attachment deleted by admin]
the code of donky shows multi colors of columns , yes , but is is colored only when selecting an item,what i need is how to show items (and sub items) with different colors always (not when selected only)
thank you
@ragdog.
I am not sure if its something in the resource or if its something with using a dialog. I myself do not use dialogs for my windows. I use the createwindowex api.
@ossama
Following the link that jupiter posted there is an example that shows what it is you want. If are able to translate the code then it will work fine. If not then maybe when i get the time i will sit down and do it.
QuoteIf not then maybe when i get the time i will sit down and do it
thank you for help :U
Quote from: Jupiter on January 02, 2008, 03:24:01 PM
Article at CodeProject: Neat Stuff to Do in List Controls Using Custom Draw (http://www.codeproject.com/KB/combobox/lvcustomdraw.aspx)
yes this is what i want,i will look in the source code and try to translate what i need to masm, i will post an example in masm later,
thank you Jupiter, and Jakal and all of you who had tried to help
REGARDS OSSAMA
hi ragdog,
i had read the topic that jupiter posted here, and i it may help you .if you cant translate the code to masm i will try to do it for you
regards OSSAMA
thank you jupiter for the URL :U
codeproject.com is very good place for win32 programming
ossama
glad that I helped you ;)
(at CodeProject) there are many good articles in many categories!
btw, there is no need to convert C code (sometimes), coz you can create .lib and use it with masm