Jump to content

Pic button deforms after being minimized


Fraser
 Share

Go to solution Solved by Fraser,

Recommended Posts

Hi,

I have created a custom picture button for my gui, however after minimizing/maximizing the gui the picture is stretched and I can't figure out a way to get it to get back to normal.

Here are the main bit of the code:

Creation of the button

$pic_min = GUICtrlCreatePic(@TempDir & "\PW Generator\images\x_min_1" & $header_colour & ".gif", 550, 0, 0, 0)

Case to minimize the gui when the button is pressed

Case $pic_min
GUISetState(@SW_MINIMIZE, $main)

Function to switch the image on hover

$cursor = GUIGetCursorInfo($main)
        If Not @error Then
            Select
                Case $cursor[4] = $pic_exit And $Icon1UnderCursor = False
                    GUICtrlSetImage($pic_exit, @TempDir & "\PW Generator\images\x_close_2" & $header_colour & ".gif")
;~                  MsgBox(0, "test", "Test")
                    $Icon1UnderCursor = True
                Case $cursor[4] <> $pic_exit And $Icon1UnderCursor
                    GUICtrlSetImage($pic_exit, @TempDir & "\PW Generator\images\x_close_1" & $header_colour & ".gif")
;~                  MsgBox(0, "test2", "Test2")
                    $Icon1UnderCursor = False
                Case $cursor[4] = $pic_min And $Icon2UnderCursor = False
                    GUICtrlSetImage($pic_min, @TempDir & "\PW Generator\images\x_min_2" & $header_colour & ".gif")
;~                  MsgBox(0, "test", "Test")
                    $Icon2UnderCursor = True
                Case $cursor[4] <> $pic_min And $Icon2UnderCursor
                    GUICtrlSetImage($pic_min, @TempDir & "\PW Generator\images\x_min_1" & $header_colour & ".gif")
;~                  MsgBox(0, "test2", "Test2")
                    $Icon2UnderCursor = False
            EndSelect
        EndIf

and here are the before and after images:

Before

19g9.png

After

do04.png

Does anyone have an idea that could help please? If you need anymore info please let me know!

Regards,
Fraser

Edited by Fraser
Link to comment
Share on other sites

I don't know but have you kept the default resizing to $GUI_DOCKSIZE for the pic? If you used GuiResizeMode it might have overridden the setting for the pic. Though if the size before minimizing is the same as maximized, which it looks like from your screen shots, then it shouldn't make any difference.

To get it back to the correct size you could get the dimensions after creating it by using ControlGetPos, then write a handler for OnExitSizeMove and use ControlMove, though it's a cludge.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Ah, interesting to know that, it could save me a problem in the future.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...