GUICtrlDelete hinterlässt graue Schatten

  • Hi, ich hab ein Problem mit der Funktion GUICtrlDelete das wenn ich z.B ein Button lösche bleibt ein Schatten in Form des alten Buttons aber dieser sollte nicht da sein weil mein Hintergrund Transparent ist.
    vielleicht weiss jemand von euch woran das liegen könnte oder wie ich soetwas verhinder kann.

    Hier noch ein kleines Bild wie es aussieht.

    mfg nefas

  • Hallo.

    Bitte einmal das Script mit posten, damit man es prüfen kann und evtl. eine Lösung posten könnte.

    Alina

    Lieben Gruß,
    Alina

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Geheime Information: ;)
    k3mrwmIBHejryPvylQSFieDF5f3VOnk6iLAVBGVhKQegrFuWr3iraNIblLweSW4WgqI0SrRbS7U5jI3sn50R4a15Cthu1bEr

  • [autoit]

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

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

    Dim $Visible = 1
    Dim $Set = 0
    Dim $txtGoogle
    Dim $txtIntranet
    Dim $txtLocal
    DIm $txtUser
    Dim $cmdGoogle
    Dim $cmdIntranet
    Dim $cmdLocal
    Dim $cmdUser

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

    $Parent = GUICreate("BackGround",255,123)
    GUICtrlCreatePic("C:\WINDOWS\Zapotek.bmp",0,0,255,123)
    GUISetState()
    WinSetTrans($Parent,"",1)

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

    $gui = GUICreate("Child",255,123,0,0,$WS_POPUP,$WS_EX_LAYERED+$WS_EX_MDICHILD,$Parent)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    $cmdShow = GUICtrlCreateButton("Show", 0, 0, 255, 15, 0)
    _WinAPI_SetLayeredWindowAttributes($gui,0x010203)
    WinSetTrans($gui,"",175)
    GUISetState()

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

    WinMove($gui,"",Default,Default,255,16)
    WinMove($Parent,"",Default,Default,255,35)

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

    WinSetOnTop ( "BackGround", "", 1 )

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

    While 1
    Switch GUIGetMsg()
    Case -3
    Exit
    Case $cmdShow
    _show()
    EndSwitch
    WEnd

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

    Func _show()
    if $Visible = 1 Then

    $txtGoogle = GUICtrlCreateInput("search Google...", 16, 4, 191, 21)
    _GuiCtrlMakeTrans(-1,130)
    $cmdGoogle = GUICtrlCreateButton("(Not allowed)", 212, 0, 26, 26, BitOR($BS_FLAT,$BS_BITMAP))
    _GuiCtrlMakeTrans(-1,130)
    GUICtrlSetImage(-1, "\\WETP030A\uid67481$O$\Scripte\Source\-=Project=-\Finder\grafics\google_trans.bmp", 0)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    $txtIntranet = GUICtrlCreateInput("search IntraNet...", 16, 29, 191, 21)
    _GuiCtrlMakeTrans(-1,130)
    $cmdIntranet = GUICtrlCreateButton("(Not allowed)", 212, 25, 26, 26, BitOR($BS_FLAT,$BS_BITMAP))
    _GuiCtrlMakeTrans(-1,130)
    GUICtrlSetImage(-1, "\\WETP030A\uid67481$O$\Scripte\Source\-=Project=-\Finder\grafics\Conti.bmp", 0)
    $txtLocal = GUICtrlCreateInput("search Local...", 16, 54, 191, 21)
    _GuiCtrlMakeTrans(-1,130)
    $cmdLocal = GUICtrlCreateButton("(Not allowed)", 212, 50, 26, 26, BitOR($BS_FLAT,$BS_BITMAP))
    _GuiCtrlMakeTrans(-1,130)
    GUICtrlSetImage(-1, "\\WETP030A\uid67481$O$\Scripte\Source\-=Project=-\Finder\grafics\PC.bmp", 0)
    $txtUser = GUICtrlCreateInput("search User...", 17, 79, 191, 21)
    _GuiCtrlMakeTrans(-1,130)
    $cmdUser = GUICtrlCreateButton("(Not allowed)", 212, 75, 26, 26, BitOR($BS_FLAT,$BS_BITMAP))
    _GuiCtrlMakeTrans(-1,130)
    GUICtrlSetImage(-1, "\\WETP030A\uid67481$O$\Scripte\Source\-=Project=-\Finder\grafics\User.bmp", 0)

    $Visible = 0

    Else

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

    GUICtrlDelete ($txtGoogle)
    GUICtrlDelete ($txtIntranet)
    GUICtrlDelete ($txtLocal)
    GUICtrlDelete ($txtUser)
    GUICtrlDelete ($cmdGoogle)
    GUICtrlDelete ($cmdIntranet)
    GUICtrlDelete ($cmdLocal)
    GUICtrlDelete ($cmdUser)

    $Visible = 1

    EndIf
    EndFunc

    [/autoit]

    So das ist der Teil den es betrifft.
    besten Dank shon mal ;)

  • Mit dem Teil / Ausschnitt bekomme ich Fehlermeldungen.
    Also ist es nicht zu testen. Sorry.

    Gruß,
    Alina.

    Lieben Gruß,
    Alina

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Geheime Information: ;)
    k3mrwmIBHejryPvylQSFieDF5f3VOnk6iLAVBGVhKQegrFuWr3iraNIblLweSW4WgqI0SrRbS7U5jI3sn50R4a15Cthu1bEr

  • So ich hab es umgangen indem ich die komplette GUI lösche und neu lade, sorry für den Teil code hier mal den kompletten.
    Es enthällt allerdings zwei funktionen die ich aus forem copiert hatte.
    ich hoffe das ist nicht schlimm.

    [autoit]

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

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

    Dim $Visible = 1
    Dim $Set = 0
    Dim $txtGoogle
    Dim $txtIntranet
    Dim $txtLocal
    DIm $txtUser
    Dim $cmdGoogle
    Dim $cmdIntranet
    Dim $cmdLocal
    Dim $cmdUser

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

    Func BuildGUI()

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

    Global $Parent = GUICreate("BackGround",255,123,-1,0)
    ;GUICtrlCreatePic("C:\WINDOWS\Zapotek.bmp",0,0,255,123)
    GUISetState()
    WinSetTrans($Parent,"",1)

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

    Global $gui = GUICreate("Child",255,123,0,0,$WS_POPUP,$WS_EX_LAYERED+$WS_EX_MDICHILD,$Parent)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    Global $cmdShow = GUICtrlCreateButton("Show", 0, 0, 255, 15, 0)
    _WinAPI_SetLayeredWindowAttributes($gui,0x010203)
    WinSetTrans($gui,"",175)
    GUISetState()

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

    WinMove($gui,"",Default,Default,255,16)
    WinMove($Parent,"",Default,Default,255,35)

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

    WinSetOnTop ( "BackGround", "", 1 )

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

    EndFunc

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

    BuildGUI()

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

    While 1
    Switch GUIGetMsg()
    Case -3
    Exit
    Case $cmdShow
    _show()
    EndSwitch
    WEnd

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

    Func _show()
    if $Visible = 1 Then

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


    $txtGoogle = GUICtrlCreateInput("search Google...", 16, 4, 191, 21)
    _GuiCtrlMakeTrans(-1,130)
    $cmdGoogle = GUICtrlCreateButton("(Not allowed)", 212, 0, 26, 26, BitOR($BS_FLAT,$BS_BITMAP))
    _GuiCtrlMakeTrans(-1,130)
    GUICtrlSetImage(-1, "\\WETP030A\uid67481$O$\Scripte\Source\-=Project=-\Finder\grafics\google_trans.bmp", 0)
    GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
    $txtIntranet = GUICtrlCreateInput("search IntraNet...", 16, 29, 191, 21)
    _GuiCtrlMakeTrans(-1,130)
    $cmdIntranet = GUICtrlCreateButton("(Not allowed)", 212, 25, 26, 26, BitOR($BS_FLAT,$BS_BITMAP))
    _GuiCtrlMakeTrans(-1,130)
    GUICtrlSetImage(-1, "\\WETP030A\uid67481$O$\Scripte\Source\-=Project=-\Finder\grafics\Conti.bmp", 0)
    $txtLocal = GUICtrlCreateInput("search Local...", 16, 54, 191, 21)
    _GuiCtrlMakeTrans(-1,130)
    $cmdLocal = GUICtrlCreateButton("(Not allowed)", 212, 50, 26, 26, BitOR($BS_FLAT,$BS_BITMAP))
    _GuiCtrlMakeTrans(-1,130)
    GUICtrlSetImage(-1, "\\WETP030A\uid67481$O$\Scripte\Source\-=Project=-\Finder\grafics\PC.bmp", 0)
    $txtUser = GUICtrlCreateInput("search User...", 17, 79, 191, 21)
    _GuiCtrlMakeTrans(-1,130)
    $cmdUser = GUICtrlCreateButton("(Not allowed)", 212, 75, 26, 26, BitOR($BS_FLAT,$BS_BITMAP))
    _GuiCtrlMakeTrans(-1,130)
    GUICtrlSetImage(-1, "\\WETP030A\uid67481$O$\Scripte\Source\-=Project=-\Finder\grafics\User.bmp", 0)

    $Visible = 0

    Else
    GUIDelete($Parent)
    $Visible = 1

    BuildGUI()

    EndIf
    EndFunc

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

    ;===============================================================================
    ;
    ; Function Name: _WinAPI_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( 0x00bbggrr ), 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
    ;
    ; Link : @@MsdnLink@@ SetLayeredWindowAttributes
    ; Example : Yes
    ;===============================================================================
    ;
    Func _WinAPI_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $dwFlages = 0x03, $isColorRef = False)
    If $dwFlages = Default Or $dwFlages = "" Or $dwFlages < 0 Then $dwFlages = 0x03
    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", $dwFlages)
    Select
    Case @error
    Return SetError(@error, 0, 0)
    Case $Ret[0] = 0
    Return SetError(4, _WinAPI_GetLastError(), 0)
    Case Else
    Return 1
    EndSelect
    EndFunc ;==>_WinAPI_SetLayeredWindowAttributes

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

    Func _GuiCtrlMakeTrans($iCtrlID,$iTrans=255)

    Local $pHwnd, $nHwnd, $aPos, $a

    $hWnd = GUICtrlGetHandle($iCtrlID);Get the control handle
    If $hWnd = 0 then Return SetError(1,1,0)
    $pHwnd = DllCall("User32.dll", "hwnd", "GetParent", "hwnd", $hWnd);Get the parent Gui Handle
    If $pHwnd[0] = 0 then Return SetError(1,2,0)
    $aPos = ControlGetPos($pHwnd[0],"",$hWnd);Get the current pos of the control
    If @error then Return SetError(1,3,0)
    $nHwnd = GUICreate("", $aPos[2], $aPos[3], $aPos[0], $aPos[1], 0x80000000, 0x00080000 + 0x00000040, $pHwnd[0]);greate a gui in the position of the control
    If $nHwnd = 0 then Return SetError(1,4,0)
    $a = DllCall("User32.dll", "hwnd", "SetParent", "hwnd", $hWnd, "hwnd", $nHwnd);change the parent of the control to the new gui
    If $a[0] = 0 then Return SetError(1,5,0)
    If NOT ControlMove($nHwnd,'',$hWnd,0,0) then Return SetError(1,6,-1);Move the control to 0,0 of the newly created child gui
    GUISetState(@SW_Show,$nHwnd);show the new child gui
    WinSetTrans($nHwnd,"",$iTrans);set the transparency
    If @error then Return SetError(1,7,0)
    GUISwitch($pHwnd[0]);switch back to the parent Gui

    Return $nHwnd;Return the handle for the new Child gui

    EndFunc

    [/autoit]

    Es könnte sein das du wieder errors bekommst wegen den Bildern auf den Buttons.

    jetzt hab ich nur noch da sproblem das man das fenster nur verschieben kann wenn man auf den nichtsichtbaren Fensterramen klickt oberhalt des Buttons "Show" und das es flackert beim neu erstellen.
    mfg

    nefas