News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Using Masked Bitmaps with Buttons with Visual Styles

Started by xandaz, March 09, 2012, 09:45:17 PM

Previous topic - Next topic

xandaz

    The code below was suppose to draw the button's bitmaps without eraseing the visual style but doesn't work. Can anyone say why? I call the default button proc when WM_PAINT to paint the button and the proceed with drawing the bitmap over it. The only thing that shows is the button.No Btimap
ButtonProc  PROC    hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD

    .if     uMsg==WM_PAINT
        invoke  CallWindowProc,lpDefButtonProc,hWnd,uMsg,wParam,lParam
        invoke  BeginPaint,hWnd,addr ps
        invoke  GetWindowLong,hWnd,GWL_ID
        add     ps.rcPaint.left,2
        add     ps.rcPaint.top,2
        .if     eax==PrevId
            invoke  ImageList_Draw,hIml,0,ps.hdc,ps.rcPaint.left,ps.rcPaint.top,ILD_TRANSPARENT
        .elseif eax==NextId
            invoke  ImageList_Draw,hIml,1,ps.hdc,ps.rcPaint.left,ps.rcPaint.top,ILD_TRANSPARENT
        .else
            invoke  ImageList_Draw,hIml2,0,ps.hdc,ps.rcPaint.left,ps.rcPaint.top,ILD_TRANSPARENT
        .endif
        invoke  EndPaint,hWnd,addr ps
    .else
        invoke  CallWindowProc,lpDefButtonProc,hWnd,uMsg,wParam,lParam
    .endif
    ret                           
           
ButtonProc  endp

   Thanks in advance
   Later

dedndave

not sure about the problem
but, i don't think it's a good idea to modify the paint struct rectangle - you pass that struct back to EndPaint
i could be wrong about that - lol
anyways - it is telling you what needs to be painted - you are sure to have problems if you don't paint it all

hutch--

Don't try and modify a BUTTON class window, create your own window and draw on it in whatever way suits what you want it to look like.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

jj2007

Quote from: hutch-- on March 10, 2012, 04:58:46 AM
Don't try and modify a BUTTON class window, create your own window and draw on it in whatever way suits what you want it to look like.

Right. Buttons are difficult to modify, if you need a control to play with, choose static with SS_NOTIFY - it will send the buttondown message, too.

xandaz

   Well....problem solved with CreateIconIndirect and BM_SETIMAGE. Thanks a lot guys.
   Hail M32