Jump to content

Where'd my Butt go?


lowbred
 Share

Recommended Posts

Can someone pls explain why the button disappears when gui is minimized..?

#include <GUIConstantsEx.au3>
#include <ColorConstants.au3>
#include <WindowsConstants.au3>
#include <GUICtrlOnHover.au3>
#include <GDIPlus.au3>
#include <SendMessage.au3>

_GDIPlus_Startup()

Local $hGUI = GUICreate("Example", 500, 250) ;, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX))

$Button1 = GUICtrlCreatePic('', 0, 0, 0, 0)
_GUICtrl_OnHoverRegister(-1, "_Hover_Proc", "_Leave_Hover_Proc", "PrimaryDown_Proc", "PrimaryUp_Proc")
SendImageToPicControl("normal_1.png", $Button1)

GUISetState(@SW_SHOW, $hGUI)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop

        Case $Button1

    EndSwitch
WEnd

GUIDelete($hGUI)

Func SendImageToPicControl($sImage, $iCtrlID)
    Local Const $hImage = _GDIPlus_ImageLoadFromFile($sImage)
    Local Const $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    _WinAPI_DeleteObject(GUICtrlSendMsg($iCtrlID, 0x0172, $IMAGE_BITMAP, $hHBitmap))
    _WinAPI_DeleteObject($hHBitmap)
    _GDIPlus_ImageDispose($hImage)
EndFunc   ;==>SendImageToPicControl

;;;;;;;;;;;;;;;;;;;;;;;;;;PNG Button 1;;;;;;;;;;;;;;;;;;;;;;;;;;
Func _Hover_Proc($iCtrlID)
    Switch $iCtrlID
        Case $Button1
            SendImageToPicControl("hover_1.png", $Button1)
    EndSwitch
EndFunc   ;==>_Hover_Proc

Func _Leave_Hover_Proc($iCtrlID)
    Switch $iCtrlID
        Case $Button1
            SendImageToPicControl("normal_1.png", $Button1)
    EndSwitch
EndFunc   ;==>_Leave_Hover_Proc

Func PrimaryDown_Proc($iCtrlID)
    Switch $iCtrlID
        Case $Button1
            SendImageToPicControl("pressed_1.png", $Button1)
    EndSwitch
EndFunc   ;==>PrimaryDown_Proc

Func PrimaryUp_Proc($iCtrlID)
    Switch $iCtrlID
        Case $Button1
            SendImageToPicControl("enabled_1.png", $Button1)
    EndSwitch
EndFunc   ;==>PrimaryUp_Proc
;;;;;;;;;;;;;;;;;;;;;;;;;;PNG Button 1;;;;;;;;;;;;;;;;;;;;;;;;;;
Link to comment
Share on other sites

Probably 

$Button1 = GUICtrlCreatePic('', 0, 0, 0, 0)

is the problem.

Try to enter a width and a height and you should catch your butt again.

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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