Jump to content

GUICtrlSetImage() not dislaying right


 Share

Recommended Posts

#include <GUIConstants.au3>

$iconDim    = 40
$x          = 1
$y          = 1
$iconDir    = @ScriptDir & "\icons\"

$GUI = GUICreate(@ComputerName, $iconDim * 7 + 1, $iconDim * 3 + 1)

$butDefrag = GUICtrlCreateButton("", $x, $y, $iconDim, $iconDim, $BS_ICON)
GUICtrlSetImage(-1, $iconDir & "monitor.ico")


GUISetState(@SW_SHOW)
Do
    $msg = GUIGetMsg()
    
Until $msg = $GUI_EVENT_CLOSE

If the source icon "monitor.ico" is not getting automatically resized to fit in the image control. I think this happened in another build but was then fixed?

Link to comment
Share on other sites

Thanks for the .ico.

setting an icon on a button does not resize the icon it just choose the first icon with the first size in a multiple icon file so that the reason of the behavior. it is different from the GUICtrlCreateIcon control which can select to adapt to the size.

In fact I will not make improvement as it will be needed to have a more parameters which will complexify the setimage functions.

You need to have the icon file with the right size or use Icon control.

#include <GUIConstants.au3>

$iconDim    = 40
$x          = 1
$y          = 1
$iconDir    = @ScriptDir & "\"

$GUI = GUICreate(@ComputerName, $iconDim * 7 + 1, $iconDim * 3 + 1)

$butDefrag = GUICtrlCreateButton("", $x, $y, $iconDim, $iconDim, $BS_ICON)
GUICtrlSetImage(-1, $iconDir & "monitor.ico")
GUICtrlCreateIcon($iconDir & "monitor.ico",-1, $x+$iconDim*2, $y, $iconDim, $iconDim)

GUISetState(@SW_SHOW)
Do
    $msg = GUIGetMsg()
    
Until $msg = $GUI_EVENT_CLOSE

I hope you understand complex can be too complex :whistle:

Link to comment
Share on other sites

Ok, its just that in the last build all my icons where different sizes and when i run the complied exe they all shrunk if you will into the size of 40x40 which I set. Now they appear as the actual size hense I just thought I would ask the question as I have seen icons do this before with another build a few months ago.

Thanks

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