flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
revolution
You didn't show how you are defining the button, or indeed anything, but there is a flag ownerdraw that you can set to draw your own graphics.
|
|||
![]() |
|
Overclick
As I said it is a system button BS_PUSHBUTTON it cannot be BS_OWNERDRAW at same time. I need trick to renew my picture over it in time when it redraws itself.
|
|||
![]() |
|
revolution
You might be able to sub-class it and capture the paint message.
|
|||
![]() |
|
sinsi
Can't you use the BS_BITMAP style and set the image with BM_SETIMAGE when you initialise the dialog box?
|
|||
![]() |
|
Overclick
BS_PUSHBUTTON buttons have its own nice animation that why I want to use them. Nothing I can do with them directly even change colors. Tell me how if you know.
revolution, does it mean I will prevent its own redrawing? I have to do something after it. Or maybe force my picture to be always on top somehow... sinsi, Resourse redactor don't let me to set BS_BITMAP or BS_ICON to BS_PUSHBUTTON, I'll try to force it... |
|||
![]() |
|
revolution
Overclick wrote: revolution, does it mean I will prevent its own redrawing? I have to do something after it. Or maybe force my picture to be always on top somehow... |
|||
![]() |
|
Overclick
revolution, Any example? How can I change class for given by res file item? Does it mean to create child window for button separately? BS_PUSHBUTTON have only WM_COMMAND messages doesn't it?
|
|||
![]() |
|
Furs
Try to handle NM_CUSTOMDRAW notifications? Sounds like exactly what you're looking for. Make sure you use a manifest for buttons:
MSDN wrote: Custom draw is also supported for button controls if you have an application manifest to ensure that Comctl32.dll version 6 is available. |
|||
![]() |
|
Overclick
Furs, seems you're right, I need to use CDDS_POSTPAINT or CDDS_ITEMPOSTPAINT.
How to find NMCUSTOMDRAW structure? I find NMHDR only. Or have I declare it first? Then how? Code: wmnotify: mov rax,[r9+8] ;r9 is [lParam] by default cmp rax,ID_ON je notify_id_on xor rax,rax ret notify_id_on: mov eax,[r9+16] cmp eax,NM_CUSTOMDRAW jne nothing mov eax,[r9+??????] cmp eax,CDDS_POSTPAINT jne nothing |
|||
![]() |
|
Overclick
Code: wmnotify: mov rax,[r9+8] cmp rax,ID_ON je notify_id_on xor rax,rax ret notify_id_on: mov eax,[r9+16] cmp eax,NM_CUSTOMDRAW jne nothing mov eax,[r9+24] cmp eax,CDDS_PREPAINT jne @F mov rax,CDRF_NOTIFYPOSTPAINT ret @@: cmp eax,CDDS_POSTPAINT je @F mov rax,CDRF_NOTIFYPOSTPAINT ret @@: invoke GetDlgItem,[hWnd],1002 mov [hItem],rax invoke ShowWindow,[hItem],SW_HIDE invoke ShowWindow,[hItem],SW_SHOW mov rax,CDRF_SKIPDEFAULT ret Still nothing. dwDrawStage returns only CDDS_PREPAINT and CDDS_PREERASE messages but never CDDS_POSTPAINT even ordered by CDRF_NOTIFYPOSTPAINT. What am I doing wrong? |
|||
![]() |
|
sinsi
You realize that BS_PUSHBUTTON=0, so it isn't really a style at all...BS_OWNERDRAW by itself is all you need.
|
|||
![]() |
|
Overclick
How that working here then?
example |
|||
![]() |
|
Overclick
https://docs.microsoft.com/en-us/windows/win32/controls/nm-customdraw-button
Buttons limited. Seems it's dead end. |
|||
![]() |
|
sinsi
I don't understand what you are trying to do. Showing a button with an image should be as simple as using BS_BITMAP.
Using owner draw or custom draw gives you more control over the button's appearance but is a lot of code. |
|||
![]() |
|
Overclick
sinsi, could you create nice animation for me? No? Of course it's easy to create some choppy button. But I prefer to use default one.
|
|||
![]() |
|
sinsi
Ah, so animation.
|
|||
![]() |
|
Furs
Overclick wrote: Furs, seems you're right, I need to use CDDS_POSTPAINT or CDDS_ITEMPOSTPAINT. |
|||
![]() |
|
Overclick
Furs I find it by memory scan then it dawned on me it's one structure))
It doesn't send POSTPAINT any way. I have to find another solution or search for nice pictured ownerdraw buttons. |
|||
![]() |
|
Furs
If you want to get CDDS_POSTPAINT, you have to return CDRF_NOTIFYPOSTPAINT from the CDDS_PREPAINT handler.
|
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.