Guictrlcreatepic

  • Ich wollte mal fragen ob man bei einer gui das Pic im hintergrund verändern kann?

    Also :

    Spoiler anzeigen
    [autoit]

    $wallpaper = "E:\Autoit\UHR\32577.jpg"

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

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 394, 187, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_DLGFRAME,$WS_POPUP,$WS_GROUP,$WS_CLIPSIBLINGS), BitOR($WS_EX_TRANSPARENT,$WS_EX_WINDOWEDGE))
    $MonthCal1 = GUICtrlCreateMonthCal("2010/06/15", 184, 8, 196, 164)
    $Button1 = GUICtrlCreateButton("Exit", 16, 136, 150, 35, $WS_GROUP, $WS_EX_STATICEDGE)
    GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
    $Pic1 = GUICtrlCreatePic($wallpaper, 0, 0, 393, 185, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Label2 = GUICtrlCreateLabel("20:24:25", 16, 8, 150, 47, -1, $WS_EX_CLIENTEDGE)
    GUICtrlSetFont(-1, 36, 800, 0, "Digital")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit]

    Und jetzt soll veränd das Scirpt läuft alle Zwei oder 5Sec das Bild auf ein anders gemacht werden!

    2 Mal editiert, zuletzt von MR.Multibot (15. Juni 2010 um 12:00)

  • Schau dir

    [autoit]

    GuiCtrlSetImage

    [/autoit]

    an. In meinen MP3-Player (Link siehe Signatur) ändere ich das Hintergrundbild (falls vorhanden) bei jedem neuen Titel
    Edit: zu langsam :sleeping:

    mfg (Auto)Bert

  • Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <DateTimeConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

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

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 394, 187, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_DLGFRAME,$WS_POPUP,$WS_GROUP,$WS_CLIPSIBLINGS), BitOR($WS_EX_TRANSPARENT,$WS_EX_WINDOWEDGE))
    $MonthCal1 = GUICtrlCreateMonthCal("2010/06/15", 184, 8, 196, 164)
    $Button1 = GUICtrlCreateButton("Exit", 16, 136, 150, 35, $WS_GROUP, $WS_EX_STATICEDGE)
    GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
    $Pic1 = GUICtrlCreatePic("E:\Autoit\UHR\32577.jpg", 0, 0, 393, 185, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Label2 = GUICtrlCreateLabel("20:24:25", 16, 8, 150, 47, -1, $WS_EX_CLIENTEDGE)
    GUICtrlSetFont(-1, 36, 800, 0, "Digital")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    Exit
    EndSwitch
    Sleep(2000)
    GUICtrlSetImage($Pic1, "E:\Autoit\UHR\46923.jpg")
    Sleep(2000)
    GUICtrlSetImage($Pic1, "E:\Autoit\UHR\46952.jpg")
    Sleep(2000)
    GUICtrlSetImage($Pic1, "E:\Autoit\UHR\32577.jpg")
    WEnd

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

    Das PRoblemm mann kann den Exit Button nicht drücken!

  • lass das mal lieber weg:

    Spoiler anzeigen
    [autoit]

    Sleep(2000)
    GUICtrlSetImage($Pic1, "E:\Autoit\UHR\46923.jpg")
    Sleep(2000)
    GUICtrlSetImage($Pic1, "E:\Autoit\UHR\46952.jpg")
    Sleep(2000)
    GUICtrlSetImage($Pic1, "E:\Autoit\UHR\32577.jpg")

    [/autoit]

    Wärend Sleep frägt er natürlich nicht ab ob Exit gedrückt wurde.

    Und sieh dir stattdessen mal das an

    [autoit]

    Adlibregister()

    [/autoit]


    Edit: HopFail: deine lösung hat nichts mit dem Problem zu tun

    ein Exit bewirkt bei dir das gleiche wie ein Exitloop...

  • Spoiler anzeigen
    [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    ExitLoop; anstatt Exit
    EndSwitch
    WEnd

    [/autoit]

    Edit: Was Schnitzel geschrieben hat, natürlich auch :P

    Viele Grüße,
    HopFail

  • Ja stimmt es bewirkt immer noch genau dasselber kann man auch anders pausen ein lägen ???(ansstat sleep)

  • Ja stimmt es bewirkt immer noch genau dasselber kann man auch anders pausen ein lägen ???(ansstat sleep)

    • sllep ist die schlechteste Methode, da es das komplete Skript pasiertm
    • die optimale Methode [autoit]AdlibRegister[/autoit] hat dir Schnitzel bereits gepostet
    • du kannst es aber auch mit [autoit]TimerInit
      TimerDiff[/autoit]lösen

    Entscheide dich für eine Methode (ohne sleep) stell dein Skript vor, falls es noch Probleme gibt und dir wid geholfen,

    mfg (Ato)Bert

  • Okay ich komme nich weiter ich weis nich wie ich es mit Ablibregister machen soll:(

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <DateTimeConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiButton.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1_1 = GUICreate("Form1", 394, 187, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_DLGFRAME,$WS_POPUP,$WS_GROUP,$WS_CLIPSIBLINGS), BitOR($WS_EX_TRANSPARENT,$WS_EX_WINDOWEDGE))
    $MonthCal1 = GUICtrlCreateMonthCal("2010/06/15", 184, 8, 196, 164)
    $Button1 = GUICtrlCreateButton("Exit", 16, 136, 150, 35, $WS_GROUP, $WS_EX_STATICEDGE)
    GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
    $Pic1 = GUICtrlCreatePic("E:\Bilder\Wallpaper\32577.jpg", 0, 0, 393, 185, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Label2 = GUICtrlCreateLabel("20:24:25", 16, 8, 150, 47, -1, $WS_EX_CLIENTEDGE)
    GUICtrlSetFont(-1, 36, 800, 0, "Digital")
    $Button2 = GUICtrlCreateButton("Button2", 168, 24, 1, 9, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    AdlibRegister( "Bilder", 1000)

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

    While 1
    $nMsg = GUIGetMsg()
    _GUICtrlButton_Click($Button2)
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    ExitLoop
    EndSwitch

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

    WEnd

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

    Func Bilder()
    GUICtrlSetImage($Pic1, "E:\Bilder\Wallpaper\32577.jpg")
    GUICtrlSetImage($Pic1, "E:\Bilder\Wallpaper\46923.jpg")
    GUICtrlSetImage($Pic1, "E:\Bilder\Wallpaper\46952.jpg")
    EndFunc

    [/autoit]

    Ich habe jetzt mal eine Func Bilder() gemacht? ist das so weit richtig??

  • du überschreibst mit der funktion dien bild immer 3mal und am schluss wird immer das 3te gesetzt


    du musst entweder zufällig eins setzen lassen oder mit einem counter immer wieder durchzählen


    ersteres würde so in etwa gehn


    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <DateTimeConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiButton.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1_1 = GUICreate("Form1", 394, 187, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_DLGFRAME,$WS_POPUP,$WS_GROUP,$WS_CLIPSIBLINGS), BitOR($WS_EX_TRANSPARENT,$WS_EX_WINDOWEDGE))
    $MonthCal1 = GUICtrlCreateMonthCal("2010/06/15", 184, 8, 196, 164)
    $Button1 = GUICtrlCreateButton("Exit", 16, 136, 150, 35, $WS_GROUP, $WS_EX_STATICEDGE)
    GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
    $Pic1 = GUICtrlCreatePic("E:\Bilder\Wallpaper\32577.jpg", 0, 0, 393, 185, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Label2 = GUICtrlCreateLabel("20:24:25", 16, 8, 150, 47, -1, $WS_EX_CLIENTEDGE)
    GUICtrlSetFont(-1, 36, 800, 0, "Digital")
    $Button2 = GUICtrlCreateButton("Button2", 168, 24, 1, 9, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    Global $bilder[3] = ["E:\Bilder\Wallpaper\32577.jpg", "E:\Bilder\Wallpaper\46923.jpg", "E:\Bilder\Wallpaper\46952.jpg"]; die pfade in einem array speichern
    AdlibRegister( "Bilder", 1000)
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    ExitLoop
    EndSwitch
    WEnd
    Func Bilder()
    GUICtrlSetImage($Pic1, $bilder[Random(0, Ubound($bilder), 1)]); ein zufallsbild setzen
    EndFunc

    [/autoit]

    edit: _GUICtrlButton_Click entfernt

  • die zweite Methode könnte so aussehen:

    ohne Arrays
    [autoit]


    #include <ButtonConstants.au3>
    #include <DateTimeConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiButton.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1_1 = GUICreate("Form1", 394, 187, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_DLGFRAME,$WS_POPUP,$WS_GROUP,$WS_CLIPSIBLINGS), BitOR($WS_EX_TRANSPARENT,$WS_EX_WINDOWEDGE))
    $MonthCal1 = GUICtrlCreateMonthCal("2010/06/15", 184, 8, 196, 164)
    $Button1 = GUICtrlCreateButton("Exit", 16, 136, 150, 35, $WS_GROUP, $WS_EX_STATICEDGE)
    GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
    $Pic1 = GUICtrlCreatePic("E:\Bilder\Wallpaper\32577.jpg", 0, 0, 393, 185, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Label2 = GUICtrlCreateLabel("20:24:25", 16, 8, 150, 47, -1, $WS_EX_CLIENTEDGE)
    GUICtrlSetFont(-1, 36, 800, 0, "Digital")
    $Button2 = GUICtrlCreateButton("Button2", 168, 24, 1, 9, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    $Zaeler =0
    AdlibRegister( "Bilder", 1000)

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

    While 1
    $nMsg = GUIGetMsg()
    _GUICtrlButton_Click($Button2)
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    ExitLoop
    EndSwitch

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

    WEnd
    Func Bilder()
    $Zaeler +=1
    If $Zaeler >3 Then $Zaeler = 1
    ToolTip($zaeler)
    If $Zaeler = 1 Then
    GUICtrlSetImage($Pic1, "E:\Bilder\Wallpaper\32577.jpg")
    elseIf $Zaeler = 2 Then
    GUICtrlSetImage($Pic1, "E:\Bilder\Wallpaper\46923.jpg")
    elseIf $Zaeler = 3 Then
    GUICtrlSetImage($Pic1, "E:\Bilder\Wallpaper\46952.jpg")
    EndIf
    EndFunc

    [/autoit]
    Mit Arrays
    [autoit]


    #include <ButtonConstants.au3>
    #include <DateTimeConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiButton.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1_1 = GUICreate("Form1", 394, 187, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_DLGFRAME,$WS_POPUP,$WS_GROUP,$WS_CLIPSIBLINGS), BitOR($WS_EX_TRANSPARENT,$WS_EX_WINDOWEDGE))
    $MonthCal1 = GUICtrlCreateMonthCal("2010/06/15", 184, 8, 196, 164)
    $Button1 = GUICtrlCreateButton("Exit", 16, 136, 150, 35, $WS_GROUP, $WS_EX_STATICEDGE)
    GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
    $Pic1 = GUICtrlCreatePic("E:\Bilder\Wallpaper\32577.jpg", 0, 0, 393, 185, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Label2 = GUICtrlCreateLabel("20:24:25", 16, 8, 150, 47, -1, $WS_EX_CLIENTEDGE)
    GUICtrlSetFont(-1, 36, 800, 0, "Digital")
    $Button2 = GUICtrlCreateButton("Button2", 168, 24, 1, 9, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    $Zaeler =0
    Dim $Bilder[3] = ["E:\Bilder\Wallpaper\32577.jpg","E:\Bilder\Wallpaper\46923.jpg","E:\Bilder\Wallpaper\46952.jpg"]
    AdlibRegister( "Bilder", 1000)

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

    While 1
    $nMsg = GUIGetMsg()
    _GUICtrlButton_Click($Button2)
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    ExitLoop
    EndSwitch

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

    WEnd
    Func Bilder()
    $Zaeler +=1
    If $Zaeler >UBound($Bilder) Then $Zaeler = 1
    GUICtrlSetImage($Pic1, $Bilder[$Zaeler-1])
    EndFunc

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

    (Alles ungetestet)

  • Hallo

    Was soll

    [autoit]

    _GUICtrlButton_Click

    [/autoit]

    in der Msg-Loop Schleife

    mfg (Auto)Bert

  • ehm ja es func so schon aber man kann den Button trotzdem nich drücken! ;( ;(

    Ich glaube das is etwas sch****


    autoBert: Ich hatte was ausprobiert ..Kann man weglassen ist TOTAL undwichtig!

  • ehm ja es func so schon aber man kann den Button trotzdem nich drücken!

    natürlich kann man.

    das geht doch:

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <DateTimeConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiButton.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1_1 = GUICreate("Form1", 394, 187, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_SYSMENU, $WS_DLGFRAME, $WS_POPUP, $WS_GROUP, $WS_CLIPSIBLINGS), BitOR($WS_EX_TRANSPARENT, $WS_EX_WINDOWEDGE))
    $MonthCal1 = GUICtrlCreateMonthCal("2010/06/15", 184, 8, 196, 164)
    $Button1 = GUICtrlCreateButton("Exit", 16, 136, 150, 35, $WS_GROUP, $WS_EX_STATICEDGE)
    GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
    $Pic1 = GUICtrlCreatePic("E:\Bilder\Wallpaper\32577.jpg", 0, 0, 393, 185, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
    $Label2 = GUICtrlCreateLabel("20:24:25", 16, 8, 150, 47, -1, $WS_EX_CLIENTEDGE)
    GUICtrlSetFont(-1, 36, 800, 0, "Digital")
    $Button2 = GUICtrlCreateButton("Button2", 168, 24, 1, 9, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    Global $bilder[3] = ["E:\Bilder\Wallpaper\32577.jpg", "E:\Bilder\Wallpaper\46923.jpg", "E:\Bilder\Wallpaper\46952.jpg"]; die pfade in einem array speichern
    AdlibRegister("Bilder", 1000)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    ExitLoop
    EndSwitch
    WEnd

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

    Func Bilder()
    GUICtrlSetImage($Pic1, $bilder[Random(0, UBound($bilder), 1)]); ein zufallsbild setzen
    EndFunc ;==>Bilder

    [/autoit]