Jump to content

picture as a button in gui


Recommended Posts

so i have this little gui that launches office programs.

now i wanna make it more "pretty"

like have a icon or jpg of the application on the button.

but i don't know where to begin on this

here's my code....

#include <GUIConstants.au3>
#NoTrayIcon

#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("Micro$oft Office", 213, 156, 238, 148)
$Word = GUICtrlCreateButton("Word", 0, 0, 105, 73)
$Excel = GUICtrlCreateButton("Excel", 101, -1, 105, 73)
$PowerPoint = GUICtrlCreateButton("Powerpoint", 0, 72, 105, 73)
$outlook = GUICtrlCreateButton("outlook", 101, 72, 105, 73)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

Case $Word
Run("C:\Program Files\Microsoft Office\Office12\winword.exe")
Exit

Case $Excel
Run("C:\Program Files\Microsoft Office\Office12\excel.exe")
Exit

Case $PowerPoint
Run("C:\Program Files\Microsoft Office\Office12\POWERPNT.EXE")
Exit

Case $outlook
Run("C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE")
Exit

EndSwitch
WEnd
Link to comment
Share on other sites

look this example.

#include 
#include 

_Main()

Func _Main()
Local $button1, $button2, $button3, $button4
Local $button5, $buttonclose

GUICreate("test", 240, 180)
$button1 = GUICtrlCreateButton("1", 0, 0, 40, 40, $BS_ICON)
GUICtrlSetImage(-1, "shell32.dll", 5)
$button2 = GUICtrlCreateButton("2", 40, 00, 40, 40, $BS_ICON)
GUICtrlSetImage(-1, "shell32.dll", 7)
$button3 = GUICtrlCreateButton("3", 80, 00, 40, 40, $BS_ICON)
GUICtrlSetImage(-1, "shell32.dll", 22)
$button4 = GUICtrlCreateButton("4", 120, 0, 40, 40, $BS_ICON)
GUICtrlSetImage(-1, "shell32.dll", 23)
$button5 = GUICtrlCreateButton("5", 160, 0, 40, 40, $BS_ICON)
GUICtrlSetImage(-1, "shell32.dll", 32)
$buttonclose = GUICtrlCreateButton("close", 200, 0, 40, 40, $BS_ICON)
GUICtrlSetImage(-1, "shell32.dll", 28)
GUISetState()

; Run the GUI until the dialog is closed
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $button1
;
Case $button2
;
Case $button3
;
Case $button4
;
Case $button5
;
Case $buttonclose
ExitLoop
Case Else
EndSwitch
WEnd

GUIDelete()
EndFunc ;==>_Main
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...