Jump to content

How to Get Gui Transparat..??


eri
 Share

Recommended Posts

  • Moderators

eri,

You use WinSetTrans - like this: :D

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)
GUISetBkColor(0xFF0000, $hGUI)

WinSetTrans($hGUI, "", 100)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I`m sorry Melba..

Ones again.. :D

How to set Only in Background Not for All Gui...?

Sample in this In Help Menu..*

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
    Local $button1, $button2, $button3, $button4, $hGUI
    Local $button5, $buttonclose

    $hGUI = GUICreate("test", 240, 180)
    GUISetBkColor(0xFF0000, $hGUI)
        WinSetTrans($hGUI, "", 10)
    $button1 = GUICtrlCreateButton("1", 0, 0, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1, "shell32.dll", 5)
    $button2 = GUICtrlCreateButton("2", 40, 00, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1, "shell32.dll", 7)
    $button3 = GUICtrlCreateButton("3", 80, 00, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1, "shell32.dll", 22)
    $button4 = GUICtrlCreateButton("4", 120, 0, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1, "shell32.dll", 23)
    $button5 = GUICtrlCreateButton("5", 160, 0, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1, "shell32.dll", 32)
    $buttonclose = GUICtrlCreateButton("close", 200, 0, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1, "shell32.dll", 28)
    GUISetState()

    ; Run the GUI until the dialog is closed
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $button1
                ;
            Case $button2
                ;
            Case $button3
                ;
            Case $button4
                ;
            Case $button5
                ;
            Case $buttonclose
                ExitLoop
            Case Else
        EndSwitch
    WEnd

    GUIDelete()
EndFunc   ;==>_Main

I want Only For Background and Icon Not Transparant?

Thank`s Again.. :huggles:

Link to comment
Share on other sites

  • Moderators

eri,

This the best I can do at the moment:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

Global $iX, $iY, $hGUI, $hGUI_child

_Main()

Func _Main()
    Local $button1, $button2, $button3, $button4
    Local $button5, $buttonclose

    ; Create main GUI
    $hGUI = GUICreate("test", 240, 40)
    $button1 = GUICtrlCreateButton("1", 0, 0, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1, "shell32.dll", 5)
    $button2 = GUICtrlCreateButton("2", 40, 00, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1, "shell32.dll", 7)
    $button3 = GUICtrlCreateButton("3", 80, 00, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1, "shell32.dll", 22)
    $button4 = GUICtrlCreateButton("4", 120, 0, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1, "shell32.dll", 23)
    $button5 = GUICtrlCreateButton("5", 160, 0, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1, "shell32.dll", 32)
    $buttonclose = GUICtrlCreateButton("close", 200, 0, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1, "shell32.dll", 28)
    GUISetState()

    ; Get main GUI position
    Local $aPos = WinGetPos($hGUI)
    $iX = $aPos[0]
    $iY = $aPos[1] + 66

    ; Create child GUI
    $hGUI_child = GUICreate("", 244, 100, $iX, $iY, BitOR($WS_POPUP, $WS_BORDER), -1, WinGetHandle(AutoItWinGetTitle()))
    GUISetBkColor(0xFF0000, $hGUI_child)
    WinSetTrans($hGUI_child, "", 100)
    GUISetState()

    ;Register move event to keep child synchroed with main
    GUIRegisterMsg($WM_MOVE, "My_WM_MOVE")

    ; Run the GUI until the dialog is closed
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $button1
                ;
            Case $button2
                ;
            Case $button3
                ;
            Case $button4
                ;
            Case $button5
                ;
            Case $buttonclose
                ExitLoop
            Case Else
        EndSwitch
    WEnd

    GUIDelete()
EndFunc   ;==>_Main

Func My_WM_MOVE($hWnd, $iMsg, $wParam, $lParam)

    #forceref $iMsg, $wParam, $lParam

    If $hWnd <> $hGUI Then Return
    Local $aPos = WinGetPos($hGUI)
    WinMove($hGUI_child, "", $aPos[0], $aPos[1] + 66)

EndFunc   ;==>My_WM_MOVE

Making holes in GUIs is easy - making the holes partially transparent is a lot harder! :huggles:

I will keep looking. :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

eri,

Getting better! :D

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <Constants.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

Global $iX, $iY, $hGUI, $hGUI_child

_Main()

Func _Main()
    Local $button1, $button2, $button3, $button4
    Local $button5, $buttonclose

    ; Create main GUI
    $hGUI = GUICreate("test", 240, 140)
    $button1 = GUICtrlCreateButton("1", 0, 0, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1, "shell32.dll", 5)
    $button2 = GUICtrlCreateButton("2", 40, 00, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1, "shell32.dll", 7)
    $button3 = GUICtrlCreateButton("3", 80, 00, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1, "shell32.dll", 22)
    $button4 = GUICtrlCreateButton("4", 120, 0, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1, "shell32.dll", 23)
    $button5 = GUICtrlCreateButton("5", 160, 0, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1, "shell32.dll", 32)
    $buttonclose = GUICtrlCreateButton("close", 200, 0, 40, 40, $BS_ICON)
    GUICtrlSetImage(-1, "shell32.dll", 28)
    GUISetState()

    _GUICreateInvRect($hGUI, 2, 62, 240, 100)

    ; Get main GUI position
    Local $aPos = WinGetPos($hGUI)
    $iX = $aPos[0] + 2
    $iY = $aPos[1] + 62

    ; Create child GUI
    $hGUI_child = GUICreate("", 240, 100, $iX, $iY, BitOR($WS_POPUP, $WS_BORDER), -1, WinGetHandle(AutoItWinGetTitle()))
    GUISetBkColor(0xFF0000, $hGUI_child)
    WinSetTrans($hGUI_child, "", 100)
    GUISetState()

    ;Register move event to keep child synchroed with main
    GUIRegisterMsg($WM_MOVE, "My_WM_MOVE")

    ; Run the GUI until the dialog is closed
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $button1
                ;
            Case $button2
                ;
            Case $button3
                ;
            Case $button4
                ;
            Case $button5
                ;
            Case $buttonclose
                ExitLoop
            Case Else
        EndSwitch

        If (BitAND(WinGetState($hGUI), 16) = 16) And (BitAND(WinGetState($hGUI), 16) <> 16) Then
            WinSetState($hGUI_child, "", @SW_MINIMIZE)
        ElseIf (BitAND(WinGetState($hGUI), 2) = 2) And (BitAND(WinGetState($hGUI), 16) - 16) Then
            WinSetState($hGUI_child, "", @SW_RESTORE)
        EndIf

    WEnd

    GUIDelete()
EndFunc   ;==>_Main

Func My_WM_MOVE($hWnd, $iMsg, $wParam, $lParam)

    #forceref $iMsg, $wParam, $lParam

    If $hWnd <> $hGUI Then Return
    Local $aPos = WinGetPos($hGUI)
    _WinAPI_SetWindowPos($hGUI_child, $hGUI, $aPos[0] + 2, $aPos[1] + 62, 240, 100, $SWP_NOACTIVATE)

EndFunc   ;==>My_WM_MOVE

Func _GUICreateInvRect($hWnd, $iX, $iY, $iW, $iH)

    Local $hMask_1 = _WinAPI_CreateRectRgn(0, 0, @DesktopWidth, $iY)
    Local $hMask_2 = _WinAPI_CreateRectRgn(0, 0, $iX, @DesktopHeight)
    Local $hMask_3 = _WinAPI_CreateRectRgn($iX + $iW, 0, @DesktopWidth, @DesktopHeight)
    Local $hMask_4 = _WinAPI_CreateRectRgn(0, $iY + $iH, @DesktopWidth, @DesktopHeight)

    _WinAPI_CombineRgn($hMask_1, $hMask_1, $hMask_2, 2)
    _WinAPI_CombineRgn($hMask_1, $hMask_1, $hMask_3, 2)
    _WinAPI_CombineRgn($hMask_1, $hMask_1, $hMask_4, 2)

    _WinAPI_DeleteObject($hMask_2)
    _WinAPI_DeleteObject($hMask_3)
    _WinAPI_DeleteObject($hMask_4)

    _WinAPI_SetWindowRgn($hWnd, $hMask_1, 1)

EndFunc   ;==>_GUICreateInvRect

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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