Sign in to follow this  
Followers 0
furrycow

Creating button with icon image

4 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



Perhaps, the Play.ico file is not a native icon file... It works fine over here with one of Microsoft's icon files.

Share this post


Link to post
Share on other sites

Perhaps, the Play.ico file is not a native icon file... It works fine over here with one of Microsoft's icon files.

Actually yeah, just tried the same thing and it works :). Should have tried that before! Cheers buddy.


Instant Lockerz Invite - www.instantlockerzinvite.co.uk

Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  
Followers 0