Transparente Combobox (OwnCombo)

  • Hab mal wieder was gebastelt.
    Das ganze ist noch ausbaufähig, ich weiß, aber bereits einsetzbar.

    Viel Spaß!

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>

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

    Opt("GUIOnEventMode", 1)

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

    Global $VisToggle = 0

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

    GUICreate("OwnCombo-Test", 400, 200)
    GUISetOnEvent(-3, "_Exit")

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

    GUICtrlCreatePic(StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1)) & "Examples\GUI\msoobe.jpg", 0, 0, 400, 200, 0)

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

    GUICtrlCreateLabel("OwnCombo", 20, 50, 100, 20, 0x201)
    GUICtrlSetBkColor(-1, -2)
    GUICtrlCreateLabel("Standard Combo", 220, 50, 100, 20, 0x201)
    GUICtrlSetBkColor(-1, -2)

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

    Global $hOwnCombo = _OwnCombo_Create("Hello1|Hello2|Hello3|Hello4|Hello5", 20, 80, 100, 80, -2)

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

    GUICtrlCreateCombo("", 220, 80, 100, 80)
    GUICtrlSetData(-1, "Hello1|Hello2|Hello3|Hello4|Hello5", "Hello1") ; add other item snd set a new default
    GUICtrlSetBkColor(-1, -2)

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

    GUISetState()

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

    While 1
    Sleep(20000)
    WEnd

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

    Func _OwnCombo_Create($sText, $iLeft, $iTop, $iWidth, $iHeight, $iColor = -1)
    Local $hInput, $hList, $hButton, $aText
    $aText = StringSplit($sText, "|")
    $hList = GUICtrlCreateListView("OwnCombo", $iLeft, $iTop + 18, $iWidth, $iHeight, BitOR(0x4000, 0x8000, 0x4, 0x8), BitOR(0x8, 0x20, 0x200))
    GUICtrlSendMsg(-1, 4167, 0, 1)
    GUICtrlSendMsg(-1, 4126, 0, $iWidth - 4)
    GUICtrlSetState(-1, $GUI_HIDE)
    $hButton = GUICtrlCreateButton("u", $iLeft + $iWidth - 18, $iTop + 2, 16, 16, Default, 0x20)
    GUICtrlSetOnEvent(-1, "_OwnCombo_ShowHide")
    GUICtrlSetFont(-1, 10, Default, 0, "Marlett")
    $hInput = GUICtrlCreateLabel($aText[1], $iLeft, $iTop, $iWidth, 20, 0x1200)
    If $iColor <> -1 Then
    GUICtrlSetBkColor($hInput, $iColor)
    GUICtrlSetBkColor($hList, $iColor)
    EndIf
    For $i = 1 To $aText[0]
    GUICtrlCreateListViewItem($aText[$i], $hList)
    GUICtrlSetOnEvent(-1, "_OwnCombo_SetSelText")
    Next
    GUICtrlSetState($hInput, $GUI_FOCUS)
    Return $hList
    EndFunc

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

    Func _OwnCombo_ShowHide()
    Local $CtrlID = @GUI_CtrlId - 1
    $VisToggle = Not $VisToggle
    GUICtrlSetState($CtrlID, $GUI_FOCUS)
    If $VisToggle Then
    GUICtrlSetState($CtrlID, $GUI_SHOW)
    Else
    GUICtrlSetState($CtrlID, $GUI_HIDE)
    EndIf
    EndFunc

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

    Func _OwnCombo_SetSelText()
    $VisToggle = 0
    GUICtrlSetState($hOwnCombo + 2, $GUI_FOCUS)
    GUICtrlSetData($hOwnCombo + 2, StringTrimRight(GUICtrlRead(GUICtrlRead($hOwnCombo)), 1))
    GUICtrlSetState($hOwnCombo, $GUI_HIDE)
    EndFunc

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

    Func _Exit()
    Exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit]
  • Hi funkey!


    Finde ich sehr geil! :thumbup:

    Edit:/ Frage was haben die Codezeilen auf sich bei mir 50% CPU auslastung: geendert in While alles gut! ;)

    Spoiler anzeigen
    [autoit]

    Do
    Until GUIGetMsg() = -3

    [/autoit]

    LG Kleiner

    Einmal editiert, zuletzt von Kleiner (8. September 2010 um 22:04)

  • Kann man das nicht gleich so machen?

    Spoiler anzeigen
    [autoit]

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

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

    $GUI = GUICreate('GUI', -1, 100, -1, -1, Default, $GUI_WS_EX_PARENTDRAG)
    GUISetBkColor(0xAAAAAA)
    $Slider = GUICtrlCreateSlider(150, 10, 200, 20)
    GUICtrlSetData(-1, 255 / 2.55 / 2)

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

    $Child = GUICreate('', 100, 21, 10, 10, $WS_POPUP, $WS_EX_MDICHILD, $GUI)
    GUICtrlCreateCombo("", 0, 0, 100)
    GUICtrlSetData(-1, "Item1|Item2|Item3|Item4|Item5|Item6|Item7", "Item1")
    GUICtrlSetBkColor(-1, 0xFF0000)

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

    WinSetTrans($Child, '', 255 / 2)

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

    GUISetState(@SW_SHOW, $Child)
    GUISetState(@SW_SHOW, $GUI)

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

    While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case -3
    Exit
    Case $Slider
    WinSetTrans($Child, '', GUICtrlRead($Slider) * 2.55)
    EndSwitch
    WEnd

    [/autoit]

    Ok, ist nicht das gleiche, aber so ähnlich :D

  • Ganz nett das Prog ;D

    Meine Projekte :

    Taschenrechner [X]
    JamLegend Auto-Player [Canceld]
    Launcher [X]
    Multi-Game-Quest-Viewer [Canceld]


    [autoit]

    If $goffy or not $brain Then $DeleteInetCable

    [/autoit]