Bewegter Hintergrund

  • Hi!

    Ich habe versucht hinter den Textfeldern und Buttons ein Hintergrundbild einzufügen welches sich von links nach rechts bewegen sollte.
    Es sollte dabei HINTER den Buttons und Textfeldern bleiben:

    [autoit]


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

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

    Global $Fensterhoehe = 650
    Global $Fensterbreite = 900

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

    #Region ### START Koda GUI section ### Form=C:\Dokumente und Einstellungen\ISI\Eigene Dateien\AutoIT\ISMediaportal\main.kxf
    $hwnd = GUICreate("Moving Background", $Fensterbreite, $Fensterhoehe, 226, 158)
    $backgroundimage = GUICtrlCreatePic("C:\windows\Angler.bmp", 0, 0, 300, $Fensterhoehe,BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS,$WS_EX_LAYERED))
    guictrlsetstate(-1,$GUI_DISABLE)
    $Button1 = GUICtrlCreateButton("Button1", 32, 232, 121, 33, 0)
    $Button2 = GUICtrlCreateButton("Button1", 113, 325, 121, 33, 0)
    $Button3 = GUICtrlCreateButton("Button1", 377, 185, 121, 33, 0)
    $Label1 = GUICtrlCreateLabel("Text..text..text", 48, 104, 71, 17)
    $Label2 = GUICtrlCreateLabel("Text..text..text", 58, 427, 119, 28)
    GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
    $Label3 = GUICtrlCreateLabel("Text..text..text", 235, 263, 119, 28)
    GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
    $Label4 = GUICtrlCreateLabel("Text..text..text", 433, 441, 119, 28)
    GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    $newX = 0
    do
    $newX = $newX+5
    ;guictrlsetpos($backgroundimage,$newX,0,800,$Fensterhoehe)
    controlmove($hwnd,"",$backgroundimage,$newX,0)
    sleep(100)
    until GUIGetMsg() = $GUI_EVENT_CLOSE

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


    Allerding "reißt" das Hintergrundbild (bei controlmove) die anderen GUI-Elemente irgentwie mit.... ?( ?(
    Und wenn ich es mit guictrlsetpos versuche, flimmert das Bild extrem!

    Weiß einer von euch da ne Lösung?!?!?

    thx im Vorraus!

  • Ich greife mal ein altes Thema auf, da ich gerade darüber gestolpert bin zu zufällig sah dass ISI360 online ist!

    So ist es schon fast gut, nur die 'Naht' zwischen den Bildern sieht man noch manchmal.

    Spoiler anzeigen
    [autoit]

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

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

    Global $Fensterhoehe = 650
    Global $Fensterbreite = 900
    Global $Bildbreite = $Fensterbreite

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

    #Region ### START Koda GUI section ### Form=C:\Dokumente und Einstellungen\ISI\Eigene Dateien\AutoIT\ISMediaportal\main.kxf
    $hwnd = GUICreate("Moving Background", $Fensterbreite, $Fensterhoehe, 226, 158)

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

    $backgroundimage1 = GUICtrlCreatePic(@WindowsDir&"\Angler.bmp", 0, 0, $Bildbreite, $Fensterhoehe, BitOR($WS_GROUP,$WS_CLIPSIBLINGS,$WS_EX_LAYERED))
    $backgroundimage2 = GUICtrlCreatePic(@WindowsDir&"\Angler.bmp", -$Bildbreite, 0, $Bildbreite, $Fensterhoehe, BitOR($WS_GROUP,$WS_CLIPSIBLINGS,$WS_EX_LAYERED))

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

    guictrlsetstate(-1,$GUI_DISABLE)
    $Button1 = GUICtrlCreateButton("Button1", 32, 232, 121, 33, 0)
    GUICtrlSetState(-1, $GUI_ONTOP)
    $Button2 = GUICtrlCreateButton("Button1", 113, 325, 121, 33, 0)
    GUICtrlSetState(-1, $GUI_ONTOP)
    $Button3 = GUICtrlCreateButton("Button1", 377, 185, 121, 33, 0)
    GUICtrlSetState(-1, $GUI_ONTOP)
    $Label1 = GUICtrlCreateLabel("Text..text..text", 48, 104, 71, 17)
    GUICtrlSetState(-1, $GUI_ONTOP)
    $Label2 = GUICtrlCreateLabel("Text..text..text", 58, 427, 119, 28)
    GUICtrlSetState(-1, $GUI_ONTOP)
    GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
    $Label3 = GUICtrlCreateLabel("Text..text..text", 235, 263, 119, 28)
    GUICtrlSetState(-1, $GUI_ONTOP)
    GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
    $Label4 = GUICtrlCreateLabel("Text..text..text", 433, 441, 119, 28)
    GUICtrlSetState(-1, $GUI_ONTOP)
    GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    $newX = 0
    do
    $newX = $newX+5
    controlmove($hwnd,"",$backgroundimage1,$newX,0)
    controlmove($hwnd,"",$backgroundimage2,$newX -$Bildbreite,0)

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

    If $newX = $Fensterbreite Then $newX = 0
    sleep(20)
    until GUIGetMsg() = $GUI_EVENT_CLOSE

    [/autoit]
    • Offizieller Beitrag

    Die Nähte bekommt man weg, wenn man während des neuzeichnens die GUI lockt. Und unter WindowsXP das DoubleBuffering einschalten, dann flackerts auch nicht:

    Spoiler anzeigen
    [autoit]


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

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

    Global $Fensterhoehe = 650
    Global $Fensterbreite = 900
    Global $Bildbreite = $Fensterbreite

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

    #Region ### START Koda GUI section ### Form=C:\Dokumente und Einstellungen\ISI\Eigene Dateien\AutoIT\ISMediaportal\main.kxf
    Global Const $WS_EX_COMPOSITED = 0x2000000 ; Windows XP: Paints all descendants of a window in bottom-to-top painting order using double-buffering.
    $hwnd = GUICreate("Moving Background", $Fensterbreite, $Fensterhoehe, 226, 158, Default, $WS_EX_COMPOSITED)

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

    $backgroundimage1 = GUICtrlCreatePic(@WindowsDir & "\Angler.bmp", 0, 0, $Bildbreite, $Fensterhoehe, BitOR($WS_GROUP, $WS_CLIPSIBLINGS, $WS_EX_LAYERED))
    $backgroundimage2 = GUICtrlCreatePic(@WindowsDir & "\Angler.bmp", -$Bildbreite, 0, $Bildbreite, $Fensterhoehe, BitOR($WS_GROUP, $WS_CLIPSIBLINGS, $WS_EX_LAYERED))

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

    GUICtrlSetState(-1, $GUI_DISABLE)
    $Button1 = GUICtrlCreateButton("Button1", 32, 232, 121, 33, 0)
    GUICtrlSetState(-1, $GUI_ONTOP)
    $Button2 = GUICtrlCreateButton("Button1", 113, 325, 121, 33, 0)
    GUICtrlSetState(-1, $GUI_ONTOP)
    $Button3 = GUICtrlCreateButton("Button1", 377, 185, 121, 33, 0)
    GUICtrlSetState(-1, $GUI_ONTOP)
    $Label1 = GUICtrlCreateLabel("Text..text..text", 48, 104, 71, 17)
    GUICtrlSetState(-1, $GUI_ONTOP)
    $Label2 = GUICtrlCreateLabel("Text..text..text", 58, 427, 119, 28)
    GUICtrlSetState(-1, $GUI_ONTOP)
    GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
    $Label3 = GUICtrlCreateLabel("Text..text..text", 235, 263, 119, 28)
    GUICtrlSetState(-1, $GUI_ONTOP)
    GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
    $Label4 = GUICtrlCreateLabel("Text..text..text", 433, 441, 119, 28)
    GUICtrlSetState(-1, $GUI_ONTOP)
    GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    $newX = 0
    Do
    $newX = $newX + 5
    GUISetState(@SW_LOCK)
    ControlMove($hwnd, "", $backgroundimage1, $newX, 0)
    ControlMove($hwnd, "", $backgroundimage2, $newX - $Bildbreite, 0)
    GUISetState(@SW_UNLOCK)

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

    If $newX = $Fensterbreite Then $newX = 0
    Sleep(20)
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    [/autoit]
  • Das Problem ist nur, dass man mit

    [autoit]

    Global Const $WS_EX_COMPOSITED = 0x2000000 ; Windows XP: Paints all descendants of a window in bottom-to-top painting order using double-buffering.

    [/autoit]

    gleich viel mehr CPU-Auslastung hat. Kann sein, dass das bei euren Maschinen nicht ins Gewicht fällt, aber mein Athlon XP 2400+ geht dabei ziemlich in die Knie, wenn das ganze flüssig aussehen soll.
    Vllt ginge es besser mit AdlibEnable.

  • Also auf meinem Testrechner (IntelCoreDuo 1,8 ghz, 2 Gb Ram) variiert die
    CPU Auslastung von 0-15%

    Allerdings ist mir noch aufgefallen, dass sobald ich das Skript Starte auch andere Fenster (Taskmanager, Startmenü, Systemeigenschaften...) die sich über dem Fenster befinden, zu flimmern beginnen. ?(