Sign in to follow this  
Followers 0
Analyze

How to Transparenz Gui Form ?

5 posts in this topic

#1 ·  Posted (edited)

Hi all i need short help with a transparenz background for my Form i only want to see the Graphic layer.

Hi have tested so much but dont work and im not a Pro :) in autoit ^^

Thx if you can help me out :)

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("Form2", 808, 516, 302, 218, $WS_POPUP,BitOR($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
$Graphic1 = GUICtrlCreateGraphic(80, 56, 33, 393)
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0x000000)
$Graphic2 = GUICtrlCreateGraphic(80, 56, 377, 41)
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0x000000)
$Graphic3 = GUICtrlCreateGraphic(424, 56, 33, 393)
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0x000000)
$Graphic4 = GUICtrlCreateGraphic(80, 424, 377, 25)
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0x000000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

    EndSwitch
WEnd
Edited by Analyze

Share this post


Link to post
Share on other sites



Have found it by my self thx :)

#include <GuiConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>

$Main_Gui = GUICreate("", 800, 600, 20, 20, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
$Graphic1 = GUICtrlCreateGraphic(80, 56, 33, 393)
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0x000000)
$Graphic2 = GUICtrlCreateGraphic(80, 56, 377, 41)
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0x000000)
$Graphic3 = GUICtrlCreateGraphic(424, 56, 33, 393)
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0x000000)
$Graphic4 = GUICtrlCreateGraphic(80, 424, 377, 25)
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0x000000)


GUISetControlsVisible($Main_Gui)

GUISetState()

While 1
    Sleep(1000)
WEnd

Func GUISetControlsVisible($hWnd)
    Local $aM_Mask, $aCtrlPos, $aMask
    
    $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0)
    $aLastID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", GUICtrlGetHandle(-1))
    
    For $i = 3 To $aLastID[0]
        $aCtrlPos = ControlGetPos($hWnd, '', $i)
        If Not IsArray($aCtrlPos) Then ContinueLoop
        
        $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", _
            "long", $aCtrlPos[0], _
            "long", $aCtrlPos[1], _
            "long", $aCtrlPos[0] + $aCtrlPos[2], _
            "long", $aCtrlPos[1] + $aCtrlPos[3])
        DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2)
    Next
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aM_Mask[0], "int", 1)
EndFunc

Share this post


Link to post
Share on other sites

Alternatively.

#Include <GUIConstantsEx.au3>
#Include <WinAPI.au3>
;#Include <WinAPIEx.au3>
#Include <WindowsConstants.au3>

$hForm = GUICreate("Form2", 808, 516, 302, 218, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED))
GUISetBkColor(0xABABAB)
_WinAPI_SetLayeredWindowAttributes($hForm, 0xABABAB, 0, $LWA_COLORKEY)
$Graphic1 = GUICtrlCreateGraphic(80, 56, 33, 393)
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0x000000)
$Graphic2 = GUICtrlCreateGraphic(80, 56, 377, 41)
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0x000000)
$Graphic3 = GUICtrlCreateGraphic(424, 56, 33, 393)
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0x000000)
$Graphic4 = GUICtrlCreateGraphic(80, 424, 377, 25)
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0x000000)
GUISetState()

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

Share this post


Link to post
Share on other sites

Alternatively.

#Include <GUIConstantsEx.au3>
#Include <WinAPI.au3>
;#Include <WinAPIEx.au3>
#Include <WindowsConstants.au3>

$hForm = GUICreate("Form2", 808, 516, 302, 218, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED))
GUISetBkColor(0xABABAB)
_WinAPI_SetLayeredWindowAttributes($hForm, 0xABABAB, 0, $LWA_COLORKEY)
$Graphic1 = GUICtrlCreateGraphic(80, 56, 33, 393)
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0x000000)
$Graphic2 = GUICtrlCreateGraphic(80, 56, 377, 41)
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0x000000)
$Graphic3 = GUICtrlCreateGraphic(424, 56, 33, 393)
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0x000000)
$Graphic4 = GUICtrlCreateGraphic(80, 424, 377, 25)
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0x000000)
GUISetState()

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

(Switch comment from WinAPIEx to WinApi to avoid errors)

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