TreeView Transparent

  • Hallo Leute,

    ich hoffe ihr könnt mir bei meinen Problem helfen :(

    Ich habe in meinem Script was ich schreibe einen Hintergrund (ist ein Bild...) definiert...
    Wenn ich jetzt ein TreeView erstelle und ihn mit GUICtrlSetBkColor Transparent setzte ist er schwarz...

    Wie bekomme ich es hin, dass das TreeView Element nicht den Hintergrund überschreibt?

    LG
    riki


    PS.: Danke im Vorraus

  • Hallo riki,

    und es geht doch, hier der Beweis:

    Spoiler anzeigen
    [autoit]

    #include <TreeViewConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <SliderConstants.au3>
    #include <WindowsConstants.au3>
    #include <WinApi.au3>
    #Include <GuiImageList.au3>
    #Include <GuiTreeView.au3>

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

    Opt("GuiOnEventMode",1)
    ; #GUI# =================================================================================
    Local $hItem[6], $hImage, $hRandomImage, $hTreeView
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)
    $Options = GUICreate("Options", 260, 510,2,2)
    GUISetBkColor(0xFFFFFF)
    GuiSetOnEvent($GUI_EVENT_CLOSE, "_Exit")

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

    GUICtrlCreateGroup("Transparency", 15, 15,230, 70)
    $label = GUICtrlCreateLabel("Transparency = 100%", 23, 37, -1 ,20)
    $slider = GUICtrlCreateSlider(23, 57, 200, 20, BitOR($TBS_AUTOTICKS, $WS_BORDER))
    $hTreeView = GUICtrlCreateTreeView(2, 100, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
    $hImage = _GUIImageList_Create(16, 16, 5, 3)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 110)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 131)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 135)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 136)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 137)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 138)
    _GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

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

    _GUICtrlTreeView_BeginUpdate($hTreeView)
    For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
    $hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
    For $y = 0 To _GUIImageList_GetImageCount($hImage) - 1
    $hItem[$y] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] Child Item", $x + 1), $x, $x)
    Next
    Next
    _GUICtrlTreeView_EndUpdate($hTreeView)

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

    $hRandomImage = Random(0, _GUIImageList_GetImageCount($hImage) - 1, 1)

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

    GUICtrlSetData($slider, 70)

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

    GUISetState()

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

    GUIRegisterMsg($WM_HSCROLL, "WM_HVSCROLL")

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

    ; #MAIN LOOP# ============================================================================
    While 1
    sleep(100)
    WEnd

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

    ; #FUNCTIONS# ============================================================================
    Func WM_HVSCROLL($hwnd, $iMsg, $wParam, $lParam) ; Slider
    Local $hWndFrom, $iCode
    If Not IsHWnd($Slider) Then $hWndCombo1 = GUICtrlGetHandle($Slider)
    $hWndFrom = $lParam
    $iCode = _WinAPI_HiWord ($wParam)
    Switch $hWndFrom
    Case $Slider, $hWndCombo1
    GUICtrlSetData($label, "Transparency = " & GUICtrlRead($slider)&"%")
    WinsetTrans("Options", "", GUICtrlRead($slider) * 2.55)
    EndSwitch
    EndFunc ;==>WM_HVSCROLL

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

    Func _Exit()
    Exit
    EndFunc

    [/autoit]

    Ich hab hier nur ein kleines Skript von @ChaosKeks, um den Treeview erweitert. Hat sofort geklappt. Viel Spass damit,

    Sorry, hier eine Version mit Hintergrundbild (angepasst auf TreeView, Originial gefunden AutoItScript.com Autor?)

    Spoiler anzeigen
    [autoit]

    GUICtrlSetData($slider, 70)
    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #cs ----------------------------------------------------------------------------

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

    AutoIt Version: 3.3.0.0
    Author: myName

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

    Script Function:
    Template AutoIt script.

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

    #ce ----------------------------------------------------------------------------

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

    ; Script Start - Add your code below here
    #include <GUIConstants.au3>
    #include <WindowsConstants.au3>
    #include <ProgressConstants.au3>
    #include <Constants.au3>
    #include <StaticConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <TreeViewConstants.au3>
    #Include <GuiImageList.au3>
    #Include <GuiTreeView.au3>

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

    Opt("TrayMenuMode",1)
    HotKeySet ("{F6}", "hide")
    Local $hItem[6], $hImage, $hRandomImage, $hTreeView
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)
    $1= GUICreate("TRANS GUI",700,550,-1,-1,$WS_POPUP,$WS_EX_CLIENTEDGE)
    $pic = GUICtrlCreatePic("bin\bg" &random (1,8,1) & ".jpg",0,0,700,550) ;change bgX.jpg with your jpeg
    GuiCtrlSetState(-1,$GUI_DISABLE)

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

    WinSetOnTop("TRANS","",1)
    GUISetState(@SW_SHOW,$1)
    $2= GUICreate("GUI",700,550,-1,-1,$WS_POPUP,$WS_EX_MDICHILD,$1)
    WinSetTrans ("GUI","",0)
    WinSetOnTop("GUI","",1)
    GUISetState(@SW_SHOW,$2)
    $progressbar1 = GUICtrlCreateProgress(0, 540, 700, 10, $PBS_SMOOTH )
    DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", 0, "wstr", 0)
    $close = GUICtrlCreateIcon ("bin\close.ico",-1,700-16,5,16,16)
    $w = GUICtrlCreateLabel("0",300,250,150,60)
    GUICtrlSetFont(-1, 20, 800)
    $hTreeView = GUICtrlCreateTreeView(2, 120, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
    $hImage = _GUIImageList_Create(16, 16, 5, 3)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 110)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 131)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 135)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 136)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 137)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 138)
    _GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

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

    _GUICtrlTreeView_BeginUpdate($hTreeView)
    For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
    $hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
    For $y = 0 To _GUIImageList_GetImageCount($hImage) - 1
    $hItem[$y] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] Child Item", $x + 1), $x, $x)
    Next
    Next
    _GUICtrlTreeView_EndUpdate($hTreeView)

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

    ;------------------------MENU FILE
    $filemenu = GUICtrlCreateLabel("File", 3, 0, 25, 15 )
    GUICtrlSetFont(-1, 10, 800)
    $filesDummy = GUICtrlCreateDummy()
    $fileContext = GUICtrlCreateContextMenu($filesDummy)
    $fileopen = GUICtrlCreateMenuItem("Background", $fileContext)
    GUICtrlCreateMenuItem("", $fileContext)
    $OptionsExit = GUICtrlCreateMenuItem("Exit", $fileContext)

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

    ;--------------------Menu EDIT
    $editmenu = GUICtrlCreatelabel("Edit", 33, 0, 30, 15)
    GUICtrlSetFont(-1, 10, 800)
    $editDummy = GUICtrlCreateDummy()
    $editContext = GUICtrlCreateContextMenu($editDummy)
    $editcopy = GUICtrlCreateMenuItem("Copy", $editDummy)
    $editpaste = GUICtrlCreateMenuItem("Past", $editDummy)

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

    ;---------------------MENU HELP
    $helpmenu = GUICtrlCreatelabel("Help", 63, 0, 35, 15 )
    GUICtrlSetFont(-1, 10, 800)
    $HelpDummy = GUICtrlCreateDummy()
    $HelpContext = GUICtrlCreateContextMenu($HelpDummy)
    $HelpWWW = GUICtrlCreateMenuItem("Website", $HelpContext)
    GUICtrlCreateMenuItem("", $HelpContext)
    $HelpAbout = GUICtrlCreateMenuItem("Help", $HelpContext)
    $helpregister = GUICtrlCreateMenuItem("License", $helpContext)

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

    ;-------------------LINE
    $line = GUICtrlCreateGraphic(0, 16,700,2)
    GUICtrlSetGraphic($line, $GUI_GR_LINE, 0,0)
    GUICtrlSetColor(-1, 0)
    ;-----------------ICONS
    GUICtrlCreateIcon("shell32.dll",-100,0,25,32,32,$SS_SUNKEN )
    GUICtrlCreateIcon("shell32.dll",-4,32,25,32,32,$SS_SUNKEN )
    GUICtrlCreateIcon("shell32.dll",-7,64,25,32,32,$SS_SUNKEN )
    $btn=GUICtrlCreateButton("TEST",220,220,50,20)
    $Slider1 = GUICtrlCreateSlider(10, 60, 158, 45)
    GUICtrlSetData($slider1, 90)
    WinsetTrans("Options", "", GUICtrlRead($slider1) * 2.55)

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

    GUICtrlSetLimit (-1, 100, 10)
    GUISetState(@SW_SHOW)

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

    for $a = 0 to 100
    sleep(1)
    WinSetTrans ("GUI","",$a*1.5)
    GUICtrlSetData($progressbar1, $a )
    GUICtrlSetData($w, $a& " %")
    next
    GUICtrlDelete($w)

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

    while 1
    sleep(1)
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE or $msg = $OptionsExit Then ExitLoop
    ;If $msg = $close Then ExitLoop
    if $msg =$filemenu then ShowMenu($2, $msg, $fileContext)
    if $msg =$helpregister then InputBox("License", "Type your license key",""," ",Default,Default,Default,Default,Default,$2)
    if $msg = $helpmenu then ShowMenu($2, $msg, $HelpContext)
    if $msg = $editmenu then ShowMenu($2, $msg, $editContext)
    if $msg = $fileopen then
    $var = FileOpenDialog("Select a file", @scriptDir & "\bin", "Images (*.jpg)", 1 ,"",$2 )
    GUICtrlSetImage($pic,$var)
    endif
    ;FileSelectFolder("Select","",6,"",$2)
    if $msg = $HelpAbout then msgbox(64,"Help","F6 Hide/Show Gui"& @crlf & "File/Background to change background",Default,$2)
    $a = GUICtrlRead ($Slider1) ; Ließt den aktuellen wert des Sliders aus.
    WinSetTrans ("GUI","",$a)
    GUICtrlSetData($progressbar1, $a )
    GUICtrlSetData($w, $a& " %")
    wend
    ; -------------- func
    func hide()
    GUISetState(@SW_HIDE,$1)
    GUISetState(@SW_HIDE,$2)
    HotKeySet ("{F6}", "show")
    endfunc

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

    func show()
    GUISetState(@SW_SHOW,$1)
    GUISetState(@SW_SHOW,$2)
    HotKeySet ("{F6}", "hide")
    endfunc

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

    ; Show a menu in a given GUI window which belongs to a given GUI ctrl
    Func ShowMenu($hWnd, $CtrlID, $nContextID)
    Local $arPos, $x, $y
    Local $hMenu = GUICtrlGetHandle($nContextID)

    $arPos = ControlGetPos($hWnd, "", $CtrlID)

    $x = $arPos[0]
    $y = $arPos[1] + $arPos[3]

    ClientToScreen($hWnd, $x, $y)
    TrackPopupMenu($hWnd, $hMenu, $x, $y)
    EndFunc ;==>ShowMenu

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

    ; Convert the client (GUI) coordinates to screen (desktop) coordinates
    Func ClientToScreen($hWnd, ByRef $x, ByRef $y)
    Local $stPoint = DllStructCreate("int;int")

    DllStructSetData($stPoint, 1, $x)
    DllStructSetData($stPoint, 2, $y)

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

    DllCall("user32.dll", "int", "ClientToScreen", "hwnd", $hWnd, "ptr", DllStructGetPtr($stPoint))

    $x = DllStructGetData($stPoint, 1)
    $y = DllStructGetData($stPoint, 2)
    ; release Struct not really needed as it is a local
    $stPoint = 0
    EndFunc ;==>ClientToScreen

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

    ; Show at the given coordinates (x, y) the popup menu (hMenu) which belongs to a given GUI window (hWnd)
    Func TrackPopupMenu($hWnd, $hMenu, $x, $y)
    DllCall("user32.dll", "int", "TrackPopupMenuEx", "hwnd", $hMenu, "int", 0, "int", $x, "int", $y, "hwnd", $hWnd, "ptr", 0)
    EndFunc ;==>TrackPopupMenu

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

    ; ----------------------------------------

    [/autoit]

    Hierzu benötigst du noch einen @scriptdir\bin in dem die Bilder abgelegt sind. Hier das Original ohne TreeView aber mit Bildern: autoit.de/wcf/attachment/4713/

    Edit2: Spoiler2 ausgetauscht, hatte nur ein Fragment kopiert
    Edit3: Spoiler2 ist überholt siehe Post #19
    mfg (Auto)Bert

    3 Mal editiert, zuletzt von AutoBert (12. Mai 2009 um 06:58)

  • Wie schon gesagt...
    Nicht das Fenster soll Transparent sein sonder das TreeView!
    Es darf keinen Background mehr besitzen..
    Die Frage ist nur wie.. :(

    Im Anhang mal eine Verdeutlichung,...

  • autoBert
    Das ist aber nicht das was riki wollte, wer wollte das der Hintergrund ein Bild ist, so ist alles durchsichtig, und das Bild ist auch nicht voll sichtbar! Und die schrift und alles wird ja auch trans

    mfg. Jam00

  • Tschuldigung für den Doppel-Post, aber ich hab es geschafft! Meine Eigene Kreation:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <TreeViewConstants.au3>
    #include <WindowsConstants.au3>

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

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 237, 447, 193, 125)
    GUICtrlCreatePic (@ScriptDir & "\bg1.jpg",0,0,237,447)
    GUISetState(@SW_SHOW)
    $PosOld = WinGetPos ($Form1)
    $hWnd = GUICreate("Form1", 237, 417, 193, 125+29,$WS_POPUP,$WS_EX_LAYERED,$Form1)
    GUISetBkColor(0xFFFFFF)
    $TreeView1 = GUICtrlCreateTreeView(8, 8, 217, 433)
    GUICtrlSetColor (-1,0xFF0000)
    $TreeView1_0 = GUICtrlCreateTreeViewItem("test", $TreeView1)
    $TreeView1_1 = GUICtrlCreateTreeViewItem("test", $TreeView1_0)
    $TreeView1_2 = GUICtrlCreateTreeViewItem("test", $TreeView1_1)
    $TreeView1_3 = GUICtrlCreateTreeViewItem("test1", $TreeView1)
    $TreeView1_4 = GUICtrlCreateTreeViewItem("Test", $TreeView1_3)
    $TreeView1_5 = GUICtrlCreateTreeViewItem("Test", $TreeView1_3)
    $TreeView1_6 = GUICtrlCreateTreeViewItem("test2", $TreeView1)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    GUIRegisterMsg($WM_MOVE, "_Move")
    DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hWnd, "long", 0xFFFFFF, "byte", 255, "long",True)
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

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

    EndSwitch
    WEnd
    Func _Move()
    $Pos = WinGetPos ($Form1)
    If $Pos[0] <> $PosOld[0] Or $Pos[1] <> $PosOld[1] Then
    $PosOld = WinGetPos ($Form1)
    WinMove ($hWnd,"",$Pos[0],$Pos[1]+29)
    EndIf
    EndFunc

    [/autoit]

    mfg. Jam00

  • Ich danke dir!
    Von mir aus kansnte soviele DoppelPosts machen wie du willst wenn du eine Lösung lieferst :P

    Ich schau es mir nachher mal und versuche es einzubauen :)

  • @Jam: Ist ja schön das du das Rad neu erfunden hast, aber wofür das WM_Move?

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <TreeViewConstants.au3>
    #include <WindowsConstants.au3>

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

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 237, 447, 193, 125)
    GUICtrlCreatePic (@ScriptDir & "\bg1.jpg",0,0,237,447)
    GUISetState(@SW_SHOW)
    $hWnd = GUICreate("Form1", 237, 417, 20, 50,$WS_POPUP,BitOr($WS_EX_MDICHILD,$WS_EX_LAYERED),$Form1)
    GUISetBkColor(0xFFFFFF)
    $TreeView1 = GUICtrlCreateTreeView(8, 8, 217, 433)
    GUICtrlSetColor (-1,0xFF0000)
    $TreeView1_0 = GUICtrlCreateTreeViewItem("test", $TreeView1)
    $TreeView1_1 = GUICtrlCreateTreeViewItem("test", $TreeView1_0)
    $TreeView1_2 = GUICtrlCreateTreeViewItem("test", $TreeView1_1)
    $TreeView1_3 = GUICtrlCreateTreeViewItem("test1", $TreeView1)
    $TreeView1_4 = GUICtrlCreateTreeViewItem("Test", $TreeView1_3)
    $TreeView1_5 = GUICtrlCreateTreeViewItem("Test", $TreeView1_3)
    $TreeView1_6 = GUICtrlCreateTreeViewItem("test2", $TreeView1)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hWnd, "long", 0xFFFFFF, "byte", 255, "long",True)
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd

    [/autoit]
  • Bei seinem Script war denke ich dafür nötig, dass wenn mann das Fenster bewegt hat das TreeView Element sich nicht mitbewegt hätte...

  • Hallo riki,

    hab mein Skript in Spoiler #2 von Post #3 ausgetauscht, war nicht komplett.

    Jam00, dein Ergebnis aus Post #9 überzeugt mich nicht, die Beschriftung der TreeViewItems sind nicht lesbar. Handelt es sich bei deinem angehängtem Bild um einen Screenshot, oder hast du einfach nur ein Bild aus dem von mir hochgeladenen ZIP nochmal eingestellt (Ich kann nämlich nichts von einerGUI erkennen) Dein Ergebnis von Post #13 fehlt leider auch

    @ChaosKeks, das Move benötigt er, damit der Baum im Fenster bleibt,

    einen schönen, sonnigen Tag noch

    (Auto)Bert

  • @ChaosKeks, das Move benötigt er, damit der Baum im Fenster bleibt,

    Um Popups zu Childs zu machen, gibt es MDI_Child.. Spoiler bitte mitlesen ;)

    Einen sonnigen Tag zurück!

    Edit: Hab grade dein Script durchgelesen und muss sagen das das Menu cool ist.. top =p

    2 Mal editiert, zuletzt von ChaosKeks (10. Mai 2009 um 14:07)

  • @ChaosKeks,

    das Skript ist nicht von mir, hab ich vor längerer Zeit bei AutoItScript.com gefunden, leider weiss weder den Author noch den Link, sonst könnte ich die Lorbeeren weiterreichen.

    Zitat

    Um Popups zu Childs zu machen, gibt es MDI_Child.. Spoiler bitte mitlesen

    Dieser erweiterte Stil ist mir durchaus bekannt. Ich denke Jam00 wollte eigentlich folgendes probieren:

    Spoiler anzeigen
    [autoit]

    #include <TreeViewConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <SliderConstants.au3>
    #include <WindowsConstants.au3>
    #include <WinApi.au3>
    #Include <GuiImageList.au3>
    #Include <GuiTreeView.au3>

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

    Opt("GuiOnEventMode",1)
    ; #GUI# =================================================================================
    Local $hItem[6], $hImage, $hRandomImage, $hTreeView
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)
    Local $hfrmPic = GUICreate("Form1", 237, 447+29, 193, 125,$WS_POPUP,0);,$hfrmMain);,$WS_EX_MDICHILD)
    GUICtrlCreatePic (@ScriptDir & "\bin\bg1.jpg",0,0,237,447)
    GUISetState(@SW_SHOW)
    Global $hfrmMain = GUICreate("Options",237, 447, 193, 125)
    Global $PosOld = WinGetPos ($hfrmMain)
    ;GUISetBkColor(0xFFFFFF)
    GuiSetOnEvent($GUI_EVENT_CLOSE, "_Exit")

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

    GUICtrlCreateGroup("Transparency", 15, 15,230, 70)
    $label = GUICtrlCreateLabel("Transparency = 100%", 23, 37, -1 ,20)
    $slider = GUICtrlCreateSlider(23, 57, 200, 20, BitOR($TBS_AUTOTICKS, $WS_BORDER))
    $hTreeView = GUICtrlCreateTreeView(2, 100, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
    $hImage = _GUIImageList_Create(16, 16, 5, 3)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 110)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 131)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 135)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 136)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 137)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 138)
    _GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

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

    _GUICtrlTreeView_BeginUpdate($hTreeView)
    For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
    $hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
    For $y = 0 To _GUIImageList_GetImageCount($hImage) - 1
    $hItem[$y] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] Child Item", $x + 1), $x, $x)
    Next
    Next
    _GUICtrlTreeView_EndUpdate($hTreeView)

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

    $hRandomImage = Random(0, _GUIImageList_GetImageCount($hImage) - 1, 1)

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

    GUICtrlSetData($slider, 70)
    WinsetTrans("Options", "", GUICtrlRead($slider) * 2.55)

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

    GUIRegisterMsg($WM_MOVE, "_Move")
    DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hfrmMain, "long", 0xFFFFFF, "byte", 255, "long",True)

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

    GUIRegisterMsg($WM_HSCROLL, "WM_HVSCROLL")
    ;WinSetOnTop("Options","",1)
    GUISetState(@SW_SHOW,$hfrmMain)
    WinsetTrans("Options", "", GUICtrlRead($slider) * 2.55)

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

    ; #MAIN LOOP# ============================================================================
    While 1
    sleep(100)
    WEnd

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

    ; #FUNCTIONS# ============================================================================
    Func WM_HVSCROLL($hwnd, $iMsg, $wParam, $lParam) ; Slider
    Local $hWndFrom, $iCode
    If Not IsHWnd($Slider) Then $hWndCombo1 = GUICtrlGetHandle($Slider)
    $hWndFrom = $lParam
    $iCode = _WinAPI_HiWord ($wParam)
    Switch $hWndFrom
    Case $Slider, $hWndCombo1
    GUICtrlSetData($label, "Transparency = " & GUICtrlRead($slider)&"%")
    WinsetTrans("Options", "", GUICtrlRead($slider) * 2.55)
    EndSwitch
    EndFunc ;==>WM_HVSCROLL

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

    Func _Exit()
    Exit
    EndFunc

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

    Func _Move()
    $Pos = WinGetPos ($hfrmMain)
    If $Pos[0] <> $PosOld[0] Or $Pos[1] <> $PosOld[1] Then
    $PosOld = WinGetPos ($hfrmMain)
    WinMove ($hfrmPic,"",$Pos[0]+2,$Pos[1]+29)
    EndIf
    EndFunc

    [/autoit]

    wobei ich es hier mit MDI_Child auch nicht hinbekomme(n kann), bin noch am suchen. Diese Lösung hat den Vorteil, das die Steuerelemente wieder lesbar sind (solange man einen vernünftigen Wert einstellt). Ich hoffe nur, wir haben @riki jetzt nicht abgeschreckt (hab erst vorhin gesehen, dass es sein erster Beitrag war).

    Edit1: @ChaosKeks dein Skript, hat den gleichen Schönheitsfehler, wie das von Jam00, die Beschriftung der TreeviewItems ist nicht lesbar. Und auf das andere Skript von Jam00 warte ich immer noch (vielleicht klappts ja dort)

    einen schönen, sonnigen Tag noch

    (Auto)Bert

    2 Mal editiert, zuletzt von AutoBert (10. Mai 2009 um 17:33)

  • autoBert
    Nein das habe ich nicht Probiert! Guck dir doch mal an was ich gemacht habe! Das habe ich Probiet! Ich habe nur den Falschen Style ausprobiert, deswegen brauchte ich trozdem noch _Move() was ChaosKeks dann behoben hat

    mfg. Jam00

  • Hallo riki,

    hier die (vorläufig) abschliesende Version von meiner Interpretation des Begriffes TreeView Transparent. Das TreeView-Steuerelement hat keinen schwarzen Hintergrund, das Bild ist immer zu sehen, also Thema gelöst?

    ScreenShot: autoit.de/wcf/attachment/4739/

    Source-Zip:Edit1: in Anhang verschoben

    Jam00,

    Zitat

    Okay, so ist besser, ich habe den Falschen Style genommen, ich habe es mit $SW_CHILD probiert

    dieses Ergebnis würde ich gerne sehen, da in der vorhergehenden die Beschriftung im TreeView-Steuerelement nicht zu lesen war, genauso wie bei @ChaosKeks der nur dafür gesorgt hat, dass WM_Move weggelassen werden kann.

    @riki, wenn sich schon 3 Leute für dich ins Zeug legen (mit 2 stark unterschiedlichen Interpretationen des Wortes Transparent), könntest du wenigestens einmal Bescheid geben, ob du es selber gelöst hast oder auf welcher Version du weitermachen möchtest,

    mfg (Auto)Bert

    Einmal editiert, zuletzt von AutoBert (12. Mai 2009 um 07:03)

  • Ich hab das ganz anders verstanden wie AutoBert.. Ich dachte er will alles vom TreeView transparent machen, außer eben die Schrift und das wäre ja schon oben gelöst gewesen..
    Aber trotzdem ist deine TransGui super ;)

    Einmal editiert, zuletzt von ChaosKeks (12. Mai 2009 um 14:40)