Jump to content

Creating button with icon image


 Share

Recommended Posts

Hey,

I am trying to create a button that has an image of an icon on it...this works perfectly fine when using an icon in a .dll file, already in Windows, however, when i try and use a .ico file, it does not work...in the help example it doesnt show it with .ico's and was wondering if it was possible?

Just the basic code ive got for this button so far (that isnt working) is:

$BUTStart = GUICtrlCreateButton("Start", 8, 8, 50, 40, $BS_ICON)

;_GUICtrlButton_SetImage($BUTStart,"C:\Play.ico") ; I have tried it with this method too
GUICtrlSetImage($BUTStart,"C:\Play.ico")

Thanks.

Edited by furrycow
Instant Lockerz Invite - www.instantlockerzinvite.co.uk
Link to comment
Share on other sites

I guess too it has something to do with the .ico file:

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>

Local $msg

GUICreate("My GUI"); will create a dialog box that when displayed is centered

GUICtrlCreateButton("my picture button", 10, 20, 40, 40, $BS_ICON)
GUICtrlSetImage(-1, StringLeft(@AutoItExe, StringLen(@AutoItExe) - 11) & '\icons\au3.ico')

GUISetState()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

Related to any Icon editing I strongly recommend the freeware app '@icon sushi':

http://www.towofu.net/soft/e-aicon.php

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...