TheCodeCracker Posted February 27, 2008 Posted February 27, 2008 Guys i started this thread to view the variety of coding styles used by different coders...I know how to create a 3 state button via subclassing the button window but i started this tread so that every coder can contribute their code snippets on how to skin buttons.e.g i make a 2 state button by setting the buttons property to be BS_OWNERDRAW and also creating the respective brushesand then processing it in WM_DRAWITEM message.Main proc hwnd:DWORD, umsg:DWORD, wparam:DWORD, lparam:DWORD .if umsg==WM_INITDIALOG invoke LoadBitmap,hinst,ID_BMPBTNNORMAL mov btnnormalbmp,eax invoke CreatePatternBrush,btnnormalbmp mov btnnormalbrush,eax invoke LoadBitmap,hinst,ID_BMPBTNPRESS mov btnpressbmp,eax invoke CreatePatternBrush,btnpressbmp mov btnpressbrush,eax invoke GetDlgItem,hwnd,IDC_CLOSEBTN mov btn,eax invoke GetWindowLong,btn,GWL_STYLE or eax, BS_OWNERDRAW invoke SetWindowLong,btn,GWL_STYLE,eax.elseif umsg==WM_DRAWITEM xor ecx,ecx mov ecx,lParam assume ecx: ptr DRAWITEMSTRUCT .if [ecx].CtlID == IDC_CLOSEBTN .if [ecx].itemState & ODS_SELECTED invoke FillRect,[ecx].hdc,addr [ecx].rcItem,btnpressbrush .else invoke FillRect,[ecx].hdc,addr [ecx].rcItem,btnnormalbrush .endif .elseif [ecx].CtlID==IDC_NAME || [ecx].CtlID==IDC_SERIAL invoke GetDlgItemText,hwnd,[ecx].CtlID,addr tempbuffer,sizeof tempbuffer .if eax>1 invoke DrawText,[ecx].hdc,offset tempbuffer,sizeof tempbuffer,addr [ecx].rcItem,DT_EDITCONTROL .endif .endif assume ecx:nothing .endif xor eax,eax RetMain ENDPI hope this thread will be helpful to the guys need to learn Button Skinning as well as some concepts about brushes and skinning another controls the same way as well.greetz,TCC/CiB
diablo2oo2 Posted February 27, 2008 Posted February 27, 2008 maybe this topic is interesting for you: http://www.tuts4you.com/forum/index.php?ac...t&pid=48306
TheCodeCracker Posted February 28, 2008 Author Posted February 28, 2008 Thanks alot to raqdod and Diabolo2002 for you kind and quality based example. I learnt new tricks from them. Thanks Again greetz, TCC/CiB
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now