momar33 Posted August 29, 2007 Share Posted August 29, 2007 When I use: GUICtrlCreateButton("", $bColumn2, $bRow2, $buttonWidth, $buttonHeight, $BS_ICON) GUICtrlSetImage (-1, $icon) It changes the button to look flat instead of 3d. Is there anyway to put an icon on a button and keep the button 3d? Thanks Link to comment Share on other sites More sharing options...
ashley Posted August 29, 2007 Share Posted August 29, 2007 (edited) try GUICtrlCreateButton("", $bColumn2, $bRow2, $buttonWidth, $buttonHeight, $BS_ICON) GUICtrlSetImage (-1, "shell32.dll", 40); change the number 40 to change picture Edited August 29, 2007 by ashley Free icons for your programs Link to comment Share on other sites More sharing options...
momar33 Posted August 29, 2007 Author Share Posted August 29, 2007 The icon I wan to use is not in "shell32.dll". I am using an ".exe" file. I tried it that way anyway and it is still a flat button. Link to comment Share on other sites More sharing options...
martin Posted August 29, 2007 Share Posted August 29, 2007 (edited) The icon I wan to use is not in "shell32.dll".I am using an ".exe" file.I tried it that way anyway and it is still a flat button.Doesn't look flat when I try it. Can you show more of your code? I assume that if you don't add the icon the button looks correct?EDIT: spelling Edited August 29, 2007 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
momar33 Posted August 30, 2007 Author Share Posted August 30, 2007 You have to see it next to another button that doesn't have an icon. expandcollapse popup#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Global $bColumn1, $bColumn2, $bRow1, $bRow2, $bRow3, $bRow4, $bRow5, $buttonWidth, $buttonHeight Global $CCleanerButton, $EEButton, $TweakNowButton, $AdAwareButton, $WebrootButton, $DefragButton, $SpybotButton Global $icon, $CCleaner, $Utools, $Defragger, $TNRegCleaner Global $CCleanerTime, $DefragTime $bColumn1 = 10 $bColumn2 = $bColumn1 + 160 $bRow1 = 20 $bRow2 = $bRow1 + 70 $bRow3 = $bRow2 + 70 $bRow4 = $bRow3 + 70 $bRow5 = $bRow4 + 70 $buttonWidth = 140 $buttonHeight = 60 $icon = "C:\Program Files\CCleaner\ccleaner.exe" $CCleaner = "C:\Program Files\CCleaner\ccleaner.exe" $Defragger = "C:\WINDOWS\system32\dfrg.msc" $TNRegCleaner = "C:\Program Files\TweakNow RegCleaner Pro\RegCleaner.exe" $Utools = GUICreate("UTools", 320, 380, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $CCleanerButton = GUICtrlCreateButton("Run CCleaner", $bColumn1, $bRow1, $buttonWidth, $buttonHeight) $EEButton = GUICtrlCreateButton("Run EE", $bColumn1, $bRow2, $buttonWidth, $buttonHeight) $TweakNowButton = GUICtrlCreateButton("Run TweakNow Reg Cleaner", $bColumn1, $bRow3, $buttonWidth, $buttonHeight, $BS_MULTILINE) $AdAwareButton = GUICtrlCreateButton("Run Ad-Aware", $bColumn1, $bRow4, $buttonWidth, $buttonHeight) $WebrootButton = GUICtrlCreateButton("Run Webroot Spy Sweeper", $bColumn1, $bRow5, $buttonWidth, $buttonHeight, $BS_MULTILINE) $DefragButton = GUICtrlCreateButton("Run Disk Defragmenter", $bColumn2, $bRow1, $buttonWidth, $buttonHeight, $BS_MULTILINE) $SpybotButton = GUICtrlCreateButton("Run Spybot", $bColumn2, $bRow2, $buttonWidth, $buttonHeight) GUICtrlCreateButton("", $bColumn2, $bRow3, $buttonWidth, $buttonHeight, $BS_ICON) GUICtrlSetImage (-1, $icon) GUICtrlCreateButton("Run CCleaner", $bColumn2, $bRow4, $buttonWidth, $buttonHeight, $BS_ICON) GUICtrlSetImage (-1, "shell32.dll", 40); change the number 40 to change picture GUICtrlCreateButton("Run CCleaner", $bColumn2, $bRow5, $buttonWidth, $buttonHeight) SetEvents() SetButtonFonts() GuiSetState () While 1 Sleep(100) WEnd Func _Exit() Exit EndFunc Func CCleaner() Local $runButton, $window, $timeStart $window = "CCleaner" $timeStart = TimerInit() Run($CCleaner, "") WinActivate($window) WinWaitActive($window) $runButton = ControlGetHandle($window, "", "[ID:2]") ControlClick($window, "", $runButton) GUICtrlWaitEnabled($runButton) WinClose($window) WinWaitClose($window) WinActivate($Utools) $CCleanerTime = TimerDiff($timeStart) MsgBox(0,"Run Time","CCleaner: " & FormatTime($CCleanerTime)) EndFunc Func Elminator() EndFunc Func TNRegCleaner() EndFunc Func AdAware() EndFunc Func Webroot() EndFunc Func DiskDefrag() Local $runButton, $window, $timeStart $window = "Disk Defragmenter" $timeStart = TimerInit() Run($Defragger, "") WinActivate($window) WinWaitActive($window) $runButton = ControlGetHandle($window, "", "[ID:8101]") ControlClick($window, "", $runButton) GUICtrlWaitEnabled($runButton) WinClose($window) WinWaitClose($window) WinActivate($Utools) $DefragTime = TimerDiff($timeStart) MsgBox(0,"Run Time","CCleaner: " & FormatTime($DefragTime)) EndFunc Func Spybot() EndFunc Func SetEvents() GUICtrlSetOnEvent($CCleanerButton, "CCleaner") GUICtrlSetOnEvent($EEButton, "Elminator") GUICtrlSetOnEvent($TweakNowButton, "TNRegCleaner") GUICtrlSetOnEvent($AdAwareButton, "AdAware") GUICtrlSetOnEvent($WebrootButton, "Webroot") GUICtrlSetOnEvent($DefragButton, "DiskDefrag") GUICtrlSetOnEvent($SpybotButton, "Spybot") EndFunc Func SetButtonFonts() GUICtrlSetFont($CCleanerButton, 12, 800) GUICtrlSetFont($EEButton, 12, 800) GUICtrlSetFont($TweakNowButton, 12, 800) GUICtrlSetFont($AdAwareButton, 12, 800) GUICtrlSetFont($WebrootButton, 12, 800) GUICtrlSetFont($DefragButton, 12, 800) GUICtrlSetFont($SpybotButton, 12, 800) EndFunc Func GUICtrlWaitEnabled($control) While not BitAnd(WinGetState($control, ""), 4) Sleep(100) WEnd EndFunc Func GUICtrlWaitDisabled($control) While BitAnd(WinGetState($control, ""), 4) Sleep(100) WEnd EndFunc Func FormatTime($iTicks) Local $iHours, $iMins, $iSecs If Number($iTicks) > 0 Then $iTicks = Round($iTicks / 1000) $iHours = Int($iTicks / 3600) $iTicks = Mod($iTicks, 3600) $iMins = Int($iTicks / 60) $iSecs = Round(Mod($iTicks, 60)) Return StringFormat("%02i:%02i:%02i", $iHours, $iMins, $iSecs) ElseIf Number($iTicks) = 0 Then $iHours = 0 $iTicks = 0 $iMins = 0 $iSecs = 0 Return StringFormat("%02i:%02i:%02i", $iHours, $iMins, $iSecs) Else SetError(1) Return -1 EndIf EndFunc Link to comment Share on other sites More sharing options...
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