"Transparentes" Edit + Besondere GUI "Ecken"

  • Hab wiedermal 2 Fragen an euch :rolleyes:

    1. Ist es möglich ein Edit Control "transparent" zu machen , sodass sie sich dem Hintergrundbild anpassen , der Text jedoch noch zu sehen ist

    2. ist es möglich solche Gui Ecken zu machen :

    [Blockierte Grafik: http://www3.pic-upload.de/01.04.10/8u5xlmpf9wfb.png]

    Dabei sollte das Schwarze in etwa dem Desktop entsprechen

    Also ich hoffe ich versteht was ich meine

    Sodass das die Gui Ecke "gestuft" ist

    PS : Das Bild ist in Paint entstanden :P Nich meckern :D

  • Zu 1. Nein, nicht auf herkömmliche Weise. Eigentlich garnicht. Du könntest ein Input machen, welches du drüber legtst auf nem extra GUI. Dann WinSetTrans 1. Wenn der User ins (fast) unsichtbare Edit schreibt, kannst du den Text im Lable ändern. (Label unterstützen Transparente hintergrundfarben)

    2.

    Spoiler anzeigen
    [autoit]

    $hGUI = GUICreate("")
    GUISetBkColor(0)
    _GuiRoundCorners($hGUI,0,0,90,90)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

    Func _GuiRoundCorners($hWnd, $x1, $y1, $x3, $y3)
    Local $pos, $ret, $ret2
    $pos = WinGetPos($hWnd)
    $ret = DllCall('gdi32.dll', 'long', 'CreateRoundRectRgn', 'long', $x1, 'long', $y1, 'long', $pos[2], 'long', $pos[3], 'long', $x3, 'long', $y3)
    If $ret[0] Then
    $ret2 = DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $hWnd, 'long', $ret[0], 'int', 1)
    If $ret2[0] Then
    Return 1
    Else
    Return 0
    EndIf
    Else
    Return 0
    EndIf
    EndFunc ;==>_GuiRoundCorners

    [/autoit]
    • Offizieller Beitrag

    Hi

    Zu 1.:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <windowsconstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global $sBackground = @SystemDir & "\oobe\images\mslogo.jpg"
    If @OSBuild > 6000 Then $sBackground = @SystemDir & "\oobe\background.bmp"

    [/autoit] [autoit][/autoit] [autoit]

    #region - GUI Create
    Global $Topx = 300,$Topy = 400,$extMsg
    Global $Plusx = 15, $Plusy = 70
    Global $gui1 = GUICreate("Parent GUI", 300, 300, $Topx, $Topy)
    GUISetFont(6)
    GUICtrlCreatePic($sBackground, 0, 0, 300, 300)
    GUISetState()
    Global $gui2 = GUICreate("child", 200, 250, $Topx + 15,$Topy + 70, $WS_POPUP, BitOR(0x2000000, $WS_EX_LAYERED,$WS_EX_TOOLWINDOW),$gui1);$WS_EX_COMPOSITED = 0x2000000
    GUICtrlCreateEdit("", 0, 0, 200, 250)
    GUICtrlSetFont(-1,16)
    GUICtrlSetBkColor(-1, 0xABCDEF)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $text = FileRead(@ScriptFullPath)
    GUICtrlSetData(-1, $text)
    _API_SetLayeredWindowAttributes($gui2,0xABCDEF,255);set special colour fully transparent
    GUISetState()
    ;~ winsetontop($gui2,'',1)
    GUIRegisterMsg($WM_MOVE,"Follow")
    #endregion
    ;~ WinSetTrans($gui1,"",120)

    [/autoit] [autoit][/autoit] [autoit]

    #region - GUI SelectLoop
    While 1
    $extMsg = GUIGetMsg(1)
    $msg = $extMsg[0]
    Switch $extMsg[1]
    Case $gui1
    Select
    Case $msg = $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    EndSelect

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd
    #endregion

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _API_SetLayeredWindowAttributes
    ; Description:: Sets Layered Window Attributes:) See MSDN for more informaion
    ; Parameter(s):
    ; $hwnd - Handle of GUI to work on
    ; $i_transcolor - Transparent color
    ; $Transparency - Set Transparancy of GUI
    ; $isColorRef - If True, $i_transcolor is a COLORREF-Strucure, else an RGB-Color
    ; Requirement(s): Layered Windows
    ; Return Value(s): Success: 1
    ; Error: 0
    ; @error: 1 to 3 - Error from DllCall
    ; @error: 4 - Function did not succeed - use
    ; _WinAPI_GetLastErrorMessage or _WinAPI_GetLastError to get more information
    ; Author(s): Prog@ndy
    ;
    ;===============================================================================
    ;
    Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False)

    [/autoit] [autoit][/autoit] [autoit]

    Local Const $AC_SRC_ALPHA = 1
    Local Const $ULW_ALPHA = 2
    Local Const $LWA_ALPHA = 0x2
    Local Const $LWA_COLORKEY = 0x1
    If Not $isColorRef Then
    $i_transcolor = Hex(String($i_transcolor), 6)
    $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
    EndIf
    Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA)
    Select
    Case @error
    Return SetError(@error, 0, 0)
    Case $Ret[0] = 0
    Return SetError(4, 0, 0)
    Case Else
    Return 1
    EndSelect
    EndFunc ;==>_API_SetLayeredWindowAttributes

    [/autoit] [autoit][/autoit] [autoit]

    Func Follow($hWnd)
    Local $wp = WinGetPos($gui1)
    If $hWnd = $gui1 then WinMove($gui2,"",$wp[0] + $Plusx, $wp[1] + $Plusy)

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc

    [/autoit]

    Gruß
    Spider