Sign in to follow this  
Followers 0
autoking

Mouse hover button - transparent

6 posts in this topic

Hi. Is it possible to do when you hold the mouse over a button, it will make it transparent, and when you move the

mouse away from the button, it will make it normal again?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

take a look at

Here is a example

#include "GUICtrlOnHover.au3"

GUICreate("PlayHD Example")
GUISetBkColor(0x00FF00)
GUISetState()

Global $Label[3]

$Label[0] = GUICtrlCreateLabel("Label1",8,20)
$Label[1] = GUICtrlCreateLabel("Label2",8,60)
$Label[2] = GUICtrlCreateLabel("Label4",8,120,-1,-1,0x1000) ;;$SS_SUNKEN

_GUICtrl_OnHoverRegister($Label[0],"onHover","onNormal")
_GUICtrl_OnHoverRegister($Label[1],"onHover","onNormal")
_GUICtrl_OnHoverRegister($Label[2],"onHover","onNormal")

GUICtrlSetBkColor($Label[0],0xFF0000)
GUICtrlSetBkColor($Label[1],0x0000FF)
GUICtrlSetBkColor($Label[2],-2)
While 1
$gMsg = GUIGetMsg()
Switch $gMsg
Case -3 ; X button
Exit
EndSwitch
WEnd

Func onHover($idCtrl)
Switch $idCtrl
Case $Label[0]
GUICtrlSetBkColor($Label[0],-2)
Case $Label[1]
GUICtrlSetData($Label[1],"Hover")
Case $Label[2]
GUICtrlSetColor($Label[2],0xFF0000)
EndSwitch
EndFunc

Func onNormal($idCtrl)
Switch $idCtrl
Case $Label[0]
GUICtrlSetBkColor($Label[0],0xFF0000)
Case $Label[1]
GUICtrlSetData($Label[1],"Label1")
Case $Label[2]
GUICtrlSetColor($Label[2],-2)
EndSwitch
EndFunc
Edited by PlayHD

Share this post


Link to post
Share on other sites

@autoking: what do you mean with "make it transparent" exactly?

Br,

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!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

WinSetTrans("[CLASS:Notepad]", "", 170)

but just for buttons instead of a window title

Share this post


Link to post
Share on other sites

Soemthing like that here?

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
$hGUI = GUICreate("Test", 300, 200)

$hGUI_Child = GUICreate("", 100, 75, 100, 50, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)
$idButton = GUICtrlCreateButton("Test", 0, 0,100, 50)
GUISetState(@SW_SHOW, $hGUI)
GUISetState(@SW_SHOW, $hGUI_Child)
Global $bUpdateOn = True, $bUpdateOFF = True

Do
    $aCtrl = GUIGetCursorInfo($hGUI_Child)
    Switch $aCtrl[4]
    Case $idButton
            If $bUpdateOFF Then
                WinSetTrans($hGUI_Child, "", 0x60)
                $bUpdateOFF = False
                $bUpdateOn = True
            EndIf
        Case Else
            If $bUpdateOn Then
                WinSetTrans($hGUI_Child, "", 0xFF)
                $bUpdateOn = False
                $bUpdateOFF = True
            EndIf
    EndSwitch
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $idButton
            MsgBox(0, "Test", "Button was pressed")
        EndSwitch
Until False

GUIDelete($hGUI_Child)
GUIDelete($hGUI)
Exit

Br,

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!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

that's just great :) thanks alot

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