Jump to content

Recommended Posts

Posted (edited)

Hello, I am trying to set a transparent background to the GUICtrlCreateSlider elements to show the main background. Is it possible?

#include <SliderConstants.au3>
#include <GUIConstantsEx.au3>

Example()

Func Example()

    Local $Form = GUICreate("Example GUI", 449, 211)

    GUICtrlCreatePic(@ScriptDir & '\bg.bmp', 0, 0, 0, 0)
    GUICtrlSetState(-1, $GUI_DISABLE)

    Local $Slider = GUICtrlCreateSlider(0, 0, 399, 50)

    Local $Slider_Vert = GUICtrlCreateSlider(399, 0, 50, 211, $TBS_VERT)

    GUISetState(@SW_SHOW)

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit

        EndSwitch
    WEnd

EndFunc

 

bg.bmp

Edited by Skdp
  • Skdp changed the title to Transparent background for slider element
Posted (edited)

Yes it is possible but you would need to create multiple GUIs like this :

#include <GUIConstants.au3>
#include <Constants.au3>
#include <WinAPISysWin.au3>

Opt("MustDeclareVars", True)

Example()

Func Example()
  Local $hForm = GUICreate("Example GUI", 429, 211)
  GUICtrlCreatePic(@ScriptDir & '\bg.bmp', 0, 0, 0, 0)
  GUICtrlSetState(-1, $GUI_DISABLE)
  GUISetState()

  Local $hGUI1 = GUICreate("", 379, 50, 0, 0, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_MDICHILD, $hForm)
  Local $Slider = GUICtrlCreateSlider(0, 0, 379, 50)
  GUICtrlSetBkColor(-1, 0xC0FFEE)
  GUISetState()
  _WinAPI_SetLayeredWindowAttributes($hGUI1, 0xC0FFEE)

  Local $hGUI2 = GUICreate("", 50, 211, 379, 0, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_MDICHILD, $hForm)
  Local $Slider_Vert = GUICtrlCreateSlider(0, 0, 50, 211, $TBS_VERT)
  GUICtrlSetBkColor(-1, 0xC0FFEE)
  GUISetState()
  _WinAPI_SetLayeredWindowAttributes($hGUI2, 0xC0FFEE)

  While True
    Switch GUIGetMsg()
      Case $GUI_EVENT_CLOSE
        Exit
    EndSwitch
  WEnd
EndFunc   ;==>Example

 

Edited by Nine

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
×
×
  • Create New...