GUI-Desgin-verzögerungs problem

  • hi,
    also ich hab mir überlegt nen witzigen screensaver zu gestalten,
    daher hab ich ersteinmal mit ein paar fingerübungen angefangen...
    naja da ist auch schon mein erstes problem :P

    funktionieren tut es ja, allerdings wird die schleife immer langsamer 0o
    ich denke mal es liegt daran , dass es ein paar viele guictrl's werden...
    nur so spontan fällt mir keine lösung ein die alten graphic ctrls zu löschen 0o
    naja seht selbst


    [autoit]

    #include <GUIConstants.au3>

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

    $gui = GUICreate("",100,100,-1,-1,-1,bitor($WS_EX_TOolwindow,$WS_EX_TOPMost))

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

    GUISetBkColor(0x000000)
    guisetstate(@sw_show)

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

    while True
    sleep(50)
    for $i = 1 to 100 step 5
    for $i1 = 1 to 100 step 5
    sleep(15)
    GUICtrlCreateGraphic($i,$i1,5,5)
    GUICtrlSetBkColor(-1,0x00ff00)
    GUICtrlCreateGraphic($i1,$i,5,5)
    GUICtrlSetBkColor(-1,0x0000ff)
    Next
    guisetstate(@sw_show)
    Next
    WEnd

    [/autoit]

    EDIT

    ok, das tempo hab ich jetzt zumindest mal so gelöst, aber elegant ist was anderes xD

    [autoit]

    #include <GUIConstants.au3>
    #include <Array.au3>
    $gui = GUICreate("",100,100,-1,-1,-1,bitor($WS_EX_TOolwindow,$WS_EX_TOPMost))

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

    GUISetBkColor(0x000000)

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

    dim $y[1]

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

    for $x = 0 to 100 step 5
    for $x1 = 0 to 100 step 5
    $ID = GUICtrlCreateGraphic($x,$x1,5,5)
    _ArrayAdd($y,$ID)
    $ID = GUICtrlCreateGraphic($x1,$x,5,5)
    _ArrayAdd($y,$ID)
    Next
    Next
    guisetstate(@sw_show)
    while True
    sleep(50)
    for $z = 1 to _ArrayMaxIndex($y)
    sleep(15)
    $farbe = random(1,dec("ffffff"),1)
    GUICtrlSetBkColor($y[$z],$farbe)
    guisetstate(@sw_show)
    next
    WEnd

    [/autoit]

    2 Mal editiert, zuletzt von azunai (25. März 2008 um 21:09)

    • Offizieller Beitrag

    Hallo

    Probier das mal aus:

    Spoiler anzeigen
    [autoit]

    #include<WindowsConstants.au3>
    #include<GUIConstantsEx.au3>
    $gui = GUICreate("", 100, 100, -1, -1, -1, BitOR($WS_EX_TOolwindow, $WS_EX_TOPMost))
    GUISetBkColor(0)
    $hGraph = GUICtrlCreateGraphic(0, 0, 100, 100)
    GUISetBkColor(0)

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

    GUISetState(@SW_SHOW)
    While 1
    For $x = 0 To 100 Step 5
    For $x1 = 0 To 100 Step 5
    $farbe = Random(1, Dec("ffffff"), 1)
    GUICtrlSetGraphic($hGraph, $GUI_GR_COLOR, $farbe, $farbe)
    GUICtrlSetGraphic($hGraph, $GUI_GR_RECT, $x, $x1, 5, 5)
    GUICtrlSetGraphic($hGraph, $GUI_GR_RECT, $x1, $x, 5, 5)
    Sleep(50)
    GUICtrlSetGraphic($hGraph, $GUI_GR_REFRESH)
    Next
    Next
    WEnd

    [/autoit]

    Mfg Spider

  • Hier: (Beenden mit ESC):

    Spoiler anzeigen
    [autoit]

    #include<WindowsConstants.au3>
    #include<GUIConstantsEx.au3>
    #include<GDIPlus.au3>
    HotKeySet("{ESC}","_Exit")
    $blocks = 20
    $measure = @DesktopWidth
    If @DesktopHeight > $measure Then $measure = @DesktopWidth
    $gui = GUICreate("", $measure, $measure, 0, 0, $WS_POPUP, BitOR($WS_EX_TOolwindow, $WS_EX_TOPMost))
    GUISetBkColor(0)
    $hGraph = GUICtrlCreateGraphic(0, 0, $measure, $measure)
    GUISetBkColor(0)
    _GDIPlus_Startup()

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

    GUISetState(@SW_SHOW)
    $graph = _GDIPlus_GraphicsCreateFromHWND(GUICtrlGetHandle($hGraph))
    While 1
    For $x = 0 To $measure+$blocks Step $blocks
    For $x1 = 0 To $measure+$blocks Step $blocks
    $farbe = Dec("FF"&Hex( Random(1, Dec("ffffff"), 1),6))

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

    $brush = _GDIPlus_BrushCreateSolid($farbe)
    _GDIPlus_GraphicsFillRect($graph,$x,$x1,$blocks,$blocks,$brush)
    _GDIPlus_GraphicsFillRect($graph,$x1,$x,$blocks,$blocks,$brush)
    _GDIPlus_BrushDispose($brush)
    ;~ Sleep(1)
    Next
    Next
    WEnd

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

    Func _Exit()
    Exit
    EndFunc

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

    Func OnAutoItExit()
    _GDIPlus_GraphicsDispose($graph)
    _GDIPlus_Shutdown()
    Exit
    EndFunc

    [/autoit]