Text sichtbar GUI unsichtbar

  • hallo gemeinde,
    wie muss ich meinen Quelltext aendern, damit man nur den Text ohne GUI sieht ?

    [autoit]


    #include <GUIConstants.au3>

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

    GUICreate("Test", 400, 200)
    setText(10,40,"Teste einen roten Text in Groesse 9 ",0xFF0000,"MS Times New Roman",9)
    GUISetState()

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

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

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

    ;myFunction
    Func setText($x,$y,$text,$color,$fontname,$textgroesse)
    local $label = GUICtrlCreateLabel ($text, $x, $y,StringLen($text)*$textgroesse,$textgroesse*2)
    GUICtrlSetFont($label, $textgroesse, 400, -1, $fontname)
    GUICtrlSetColor($label, $color)
    EndFunc

    [/autoit]

    Ich habs schon mit GUISetState(@sw_hide) probiert.
    Ergebnis: die GUI war weg, leider auch der Text.

    Eine direkte Lösung wird gesucht. (keine Links, Kommentare, Fragen etc.)
    Gruss @Berti

    • Offizieller Beitrag

    Schau dir mal das Beispiel in diesem Thread an :
    "Schwebende" Button - Skriptbeispiel

    Zitat

    Eine direkte Lösung wird gesucht. (keine Links, Kommentare, Fragen etc.)
    Gruss @Berti

    Ein bischen Arbeit könnte nix schaden, wir sind kein "schreib mir mal das Script Forum ".

    PS: Das Beispielsript läßt sich ohne große Probleme von den Buttons auf ein Label umbauen . Frohes probieren .

  • Ist ganz leicht:

    Spoiler anzeigen
    [autoit]

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

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

    #Region ### START Koda GUI section ### Form=
    $hWnd = GUICreate("Form1", 633, 447, Default,Default,$WS_POPUP, $WS_EX_LAYERED)
    GUISetBkColor (0x000000)
    $Label1 = GUICtrlCreateLabel("Label1", 32, 134, 34, 13)
    GUICtrlSetColor (-1,0xFF0000)
    _WinAPI_SetLayeredWindowAttributes($hWnd, 0x000000, 255)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

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

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

    EndSwitch
    WEnd
    Func _WinAPI_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $dwFlages = 0x03, $isColorRef = False)
    ; progandy
    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]

    mfg. Jam00

  • vielen Dank jam00, eukalyptus, ..

    Mein Ergebnis saehe dann so aus:

    [autoit]


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

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

    setWinHide("Test",400,200,0,0)
    setText(10,40,"roter Text in Groesse 9 ",0xFF0000,"MS Reference Sans Serif",9)
    setText(20,80,"default Text")

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

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

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

    ;myFunction
    Func setText($x,$y,$text,$color=0x00000D,$fontname="MS Times New Roman",$textgroesse=12)
    local $label = GUICtrlCreateLabel ($text, $x, $y,StringLen($text)*$textgroesse,$textgroesse*2)
    GUICtrlSetFont($label, $textgroesse, 400, -1, $fontname)
    GUICtrlSetColor($label, $color)
    EndFunc

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

    ;Erstellt eine transparente GUI
    Func setWinHide($title, $width, $height, $left, $top)
    local $hGui = GUICreate($title, $width, $height, $left ,$top ,$WS_POPUP, $WS_EX_LAYERED)
    local $bkcolor = 0x000000
    GUISetBkColor($bkcolor)
    DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hGui, "long", $bkcolor, "byte", 255, "long", 0x03)
    GUISetState()
    EndFunc

    [/autoit]

    Es funktioniert und es waren nur drei Zeilen zusaetzlich.
    Nochmals Danke
    @Berti

    3 Mal editiert, zuletzt von bertizwo (8. April 2009 um 18:13)