Sign in to follow this  
Followers 0
vagabond719

Resolved - Resource Icons

10 posts in this topic

#1 ·  Posted (edited)

I have added icons as resources. The issue I am having is after the EXE is created the icons are all smaller. They are correct size prior to being compiled. Is there something I am missing? I am only showing snippets below. 

 

 

#AutoIt3Wrapper_Res_Icon_Add=C:\Users\xxxxxx\Documents\AutoIt\images\microsoft_access.ico

If @Compiled Then
    $accessICO = @ScriptFullPath
    $accessICO_id = 201
Else
    $accessICO = @ScriptDir & "\images\microsoft_access.ico"
    $accessICO_id = 1
EndIf

$accessButton = GUICtrlCreateButton("Access", $col1, $row1, $iconH, $iconW, $BS_ICON)
GUICtrlSetImage(-1, $accessICO, $accessICO_id)
GUICtrlSetTip(-1, "Build the Access DB", "Button Description", 1, 1)

Edited by vagabond719

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi,

It's hard to see what's wrong if you dont post your entire GUI and the icon file!

We can't test anything with only the snippet you posted.

Edited by Neutro

Share this post


Link to post
Share on other sites

#3 ·  Posted

Here is the code file and images folder. The only thing I have changed is the network folders. 

EOR.zip

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Use FileInstall :)

Edited by Trong

Regards,
 

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

No it's not working properly Trong ;)

The icon size in ressource hacker is 64x64, the icon size in the compiled exe shown in your screenshot is 32x32. If it was working properly the image in each buttons of the software should have the full button size and not just show in the middle as 32x32.

I think it's a bug from the GUICtrlSetImage function. Try it out with this code:

#Region    ;************ Includes ************
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#EndRegion    ;************ Includes ************

$test = GUICreate("test", 600, 300)

Global $hIcon1 = GUICtrlCreateIcon("", Default, 20, 20, 240, 240)

Global $button1 = GUICtrlCreateButton("", 300, 20, 240, 240, $BS_ICON )

GUICtrlSetImage($hIcon1, "shell32.dll", 22)

GUICtrlSetImage($button1, "shell32.dll", 22)

GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

When GuiCtrlSetImage is used on an icon it uses the biggest size possible whereas when used on a button it uses 32x32 or 16x16 only.

Edited by Neutro
1 person likes this

Share this post


Link to post
Share on other sites

#7 ·  Posted

this is a known issue and will not be fixed. see Trac ticket.

workaround: use only 32x32 icons.

and in this case, it will make the GUI look a lot nicer. just make the buttons slightly smaller. and in general, try to use a more consistent icon design for grouped buttons of similar functionality.

2 people like this

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

As explained here you can solve this problem using ResourcesEX.au3

Changes made to your script were using this AutoIt3Wrapper to add icon files:

#AutoIt3Wrapper_Res_File_Add=images\unix_vvw_icon.ico, RT_ICON, UNIX, 0

and this function to set the icon in the button when using compiled script:

_Resource_SetToCtrlID(-1, 'UNIX', $RT_ICON)

You need to put the attached file ResourcesEx.au3 in your AutoIT\include folder for this to work.

A working version can be found in the EOR.zip filed joined as well.

Enjoy ;)

Edited by Neutro
1 person likes this

Share this post


Link to post
Share on other sites

#9 ·  Posted

6 minutes ago, Neutro said:

As explained here you can solve this problem using ResourcesEX.au3

Changes made to your script were using this AutoIt3Wrapper to add icon files:

#AutoIt3Wrapper_Res_File_Add=images\unix_vvw_icon.ico, RT_ICON, UNIX, 0

and this function to set the icon in the button when using compiled script:

_Resource_SetToCtrlID(-1, 'UNIX', $RT_ICON)

You need to put the attached file ResourcesEx.au3 in your AutoIT\include folder for this to work.

A working version can be found in the EOR.zip filed joined as well.

Enjoy ;)

Thanks, for the assist. Neutro I will look at the ResourcesEx.au3 more. 

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

You're welcome but dont bother with ResourcesEx for your script, i already fixed it ;)

Just download the EOR.zip file joined in my previous reply, put ResourcesEx.au3 in your AutoIT include folder, compile EOR2.au3 and it works ;)

Edited by Neutro

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