Sign in to follow this  
Followers 0
zeshrek

[Q] Sizing Buttons

6 posts in this topic

Hi all

First of all, I apologize for my poor english, I try to do my best but it's not my mother tongue. I come from the French Autoit forum, where nobody can help me so I ask my question here.

Then...

I have a sizing problem with icons.

I can upscale them (even if antialiasing would be welcome), I can use them on 'small' buttons, but, I can't upscale them on a large button.

In the following script, how can I have the icon of the second button (bottom left) enlarged enough to use as much surface of the button as possible, instead of this ridiculous tiny icon.

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


GUICreate(" My GUI Icons", 270, 200)

$Button1 = GUICtrlCreateButton("Button1", 10, 10, 40, 40, $BS_ICON)
GUICtrlSetImage($Button1, "C:\WINDOWS\system32\shell32.dll", 10)
$Button2 = GUICtrlCreateButton("Button2", 10, 50, 97, 97, $BS_ICON)
GUICtrlSetImage($Button2, "C:\WINDOWS\system32\shell32.dll", 10)

$icon = GUICtrlCreateIcon("shell32.dll", 10, 170, 10, 40, 40)
$icon2 = GUICtrlCreateIcon("shell32.dll", 10, 170, 50, 80, 80)

GUISetState()

While 1
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()

Hint :

If I extract the icon out of the DLL and use the .ico file instead of the DLL it works.

So I suspect a bug in icons management when they come from a DLL instead of a .ICO file.

The problem is that need the icon to remain in the DLL, as my script uses several icons, and I want to keep all of them together in the DLL. As a workaround I tryed to put a BMP file in the DLL but I don't know how to extract it and use it on the button after.

Thanks in advance

Share this post


Link to post
Share on other sites



I have a sizing problem with icons.

So why not just use the Icon as the button? If you play arrond with the styles it would look just like a button.

I added some #Include(s)

Try:

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
GUICreate(" My GUI Icons", 270, 200)
$icon = GUICtrlCreateIcon("shell32.dll", 10, 170, 10, 40, 40)
$icon2 = GUICtrlCreateIcon("shell32.dll", 10, 10, 50, 97, 97, Default , $WS_EX_CLIENTEDGE)
GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    if $msg = $icon2 then MsgBox(0, '', 'Icon2 selected', 3 )
WEnd
GUIDelete()

Share this post


Link to post
Share on other sites

Thank you JoHanatCent for this, but...

But if I use the icon as a button, it looks sunken. I would like it to be raised (like a normal button) but if i use $WS_EX_WINDOWEDGE instead of $WS_EX_CLIENTEDGE it then becomes flat. I didn't find how to raise it so it looks like a button.

Share this post


Link to post
Share on other sites

it then becomes flat. I didn't find how to raise it so it looks like a button.

Want to maybe try $SS_SIMPLE?


Share this post


Link to post
Share on other sites

You might be able to do it with _GUICtrlButton_SetImage() by setting the last parameter to True.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Thank you all

I finally droped that, and use a basic 40x40 button with a 32x32 icon on it.

Maybe next version of Autoit will allow to resize icons when they come from a DLL.

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