Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dialog Button with image?
#1
Is there a way to create a button in dialog with an image above the text?

Like a button that says start, and the icon of a start above it
#2
Add BS_TOP style to the button.
Note that image+text works only on Vista. On older OS only text is displayed. It is Windows bug or incorrect MSDN documentation (BM_SETIMAGE). To display image+text can be used toolbar control instead; it works on all OS.

Function dlg_buttons_with_icons
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

if(!ShowDialog("dlg_buttons_with_icons" &dlg_buttons_with_icons 0)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Button 0x54032000 0x0 22 46 54 14 "Button"
;4 Button 0x54032400 0x0 80 46 36 26 "Button"
;END DIALOG
;DIALOG EDITOR: "" 0x203000C "*" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,__Hicon-- t_hi1=GetFileIcon("shell32.dll,15")
,SendMessage id(3 hDlg) BM_SETIMAGE IMAGE_ICON t_hi1
,SendMessage id(4 hDlg) BM_SETIMAGE IMAGE_ICON t_hi1
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#3
"shell32.dll,15"

what does that part mean?

is that where the image file is located?
and what is the 15

Thanks
#4
Dlls contain many icons. It is icon index in the dll.
#5
so instead of that could you just put the exact path of icon?

like "\Desktop\Icon3.ico"

or something like that
#6
yes


Forum Jump:


Users browsing this thread: 3 Guest(s)