flat assembler
Message board for the users of flat assembler.

Index > Windows > ListBox coloring

Author
Thread Post new topic Reply to topic
Rayslava



Joined: 07 Mar 2006
Posts: 7
Location: Moscow, Russia
Rayslava
http://www.c-sharpcorner.com/Code/2005/April/ListBox.gif
Could anybody help to get such a fine listbox using FASM?
Where every line of list has own color.
Icons in the left aren't necessary, but they wouldn't be needless
Post 08 Mar 2006, 11:00
View user's profile Send private message ICQ Number Reply with quote
Vasilev Vjacheslav



Joined: 11 Aug 2004
Posts: 392
Vasilev Vjacheslav
Post 08 Mar 2006, 18:45
View user's profile Send private message Reply with quote
Reverend



Joined: 24 Aug 2004
Posts: 408
Location: Poland
Reverend
It's .NET technology. AFAIK such ListBox is not possible to do using the basic APIs, but of course you can always ownerdraw all the controls. But it's a lot of work Smile
Post 08 Mar 2006, 20:21
View user's profile Send private message Visit poster's website Reply with quote
r22



Joined: 27 Dec 2004
Posts: 805
r22
A VC++ code for OWNER DRAW colored listboxes can be found here

http://www.codeguru.com/cpp/controls/listbox/colorlistboxes/article.php/c1611/

Porting it to assembly would be some work but it's better than .NET
Post 09 Mar 2006, 04:18
View user's profile Send private message AIM Address Yahoo Messenger Reply with quote
mathi



Joined: 29 Mar 2004
Posts: 4
Location: Chennai, India
mathi
The source is in nasm.
Shouldn't be difficult to convert it to fasm.

Hope this helps.

Regards,
Mathi.
http://www.geocities.com/mathiisalive/


Description: Colorful listbox example.
Download
Filename: colorlist.zip
Filesize: 5.33 KB
Downloaded: 88 Time(s)

Post 09 Mar 2006, 06:34
View user's profile Send private message Visit poster's website Yahoo Messenger Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1605
Location: Ukraine
shoorick
this is a part of my code (converted once from c example)
1.
Code:
    cmp eax,WM_NOTIFY
    jne @F
    mov eax,[lParam]
    mov ecx,[list_1]
    cmp [eax + NMHDR.hwndFrom],ecx
    jne .exit_false
    cmp [eax + NMHDR.code],NM_CUSTOMDRAW
    jne .exit_false
    stdcall ProcessCustomDraw,eax
    invoke SetWindowLong,[hWnd],DWL_MSGRESULT,eax
    jmp .exit_true
    ...
    

2.
Code:
proc ProcessCustomDraw lParam
    push ebx
    mov ebx,[lParam]
    mov eax,[ebx + NMLVCUSTOMDRAW.nmcd + NMCUSTOMDRAW.dwDrawStage]
    cmp eax,CDDS_PREPAINT
    jne @F
    mov eax,CDRF_NOTIFYITEMDRAW
    jmp .done
@@:    
;    cmp eax,CDDS_ITEMPREPAINT
;    jne @F
;    mov eax,CDRF_NOTIFYSUBITEMDRAW
;    jmp .done
;@@:    
    cmp eax,CDDS_ITEMPREPAINT
    jne @F
    cmp [ebx + NMLVCUSTOMDRAW.nmcd + NMCUSTOMDRAW.dwItemSpec],-1
    ja  .done_skip
    push [wht_col]
    pop [ebx + NMLVCUSTOMDRAW.clrTextBk]
    mov eax,CDRF_NEWFONT
    jmp .done
@@:    
.done_skip:    
    mov eax,CDRF_DODEFAULT
.done:
    pop ebx
    ret
endp
    

======
little explanation to attachment: i made listview background "gray" sending WM_DISABLE to it, and then "colouring" valid items with usual white colour. lately i just start use LVM_SETBKCOLOR Wink


Description: my recent "playground" (if it can help with this :)
Download
Filename: listview4.x.5.zip
Filesize: 5.88 KB
Downloaded: 74 Time(s)

Post 09 Mar 2006, 07:36
View user's profile Send private message Visit poster's website Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1605
Location: Ukraine
shoorick
btw, i just noticed that i've been mixing listbox with listview Sad not sure that technic will help for colouring listbox also...
Post 09 Mar 2006, 11:30
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.