Viele Controls auf einmal verschieben

  • hi,
    ich hab gerade angefangen ein Strategy/Aufbauspiel zu bastellen. Ich hab mir vorher alles ausgedacht und wollte vollen tatendrang starten , doch schon nach wenigen minuten kam der erste harte fehler.und zwar wenn man sich über die karte bewegen will (vogelperspektive). Dabei muss man ja gezwungenermaßen die karte bewegen doch die besteht bei mir aus ca 10000 bildern da hab ich mir gedacht pack ich sie alle in eine Groupbox und verschieb diese einfach. leider funktioniert das so nicht. Ich bin mir zwar extrem sicher das ich das in früheren projekten auch so gemacht hab find diese aber leider nicht mehr :pinch: . Wie auch immer ich hab keine idee wie ich es sonst lösen könnte ausser alle einzeln zu verschieben... die sache soll ja ziemlich schnell gehn.
    hat jemand ne idee ? freue mich über jede hilfe

    hier noch der code wenns hilft (mit Pics im anhang)

    Spoiler anzeigen
    [autoit]

    #include-once
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <Misc.au3>

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

    ;Hilfsvariablen
    $Ctrl = 1
    $Colision = 2

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

    #Region ### START Koda GUI section ### Form=C:\Users\Geithe\Desktop\RTS Projekt\Form_Backup_001.kxf
    $Form1 = GUICreate("Form1", 1264, 704, -1, -1)
    $Group_Menu = GUICtrlCreateGroup("", -8, -8, 249, 737)
    ; interface....
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group_Game = GUICtrlCreateGroup("", 248, 0, 1017, 713)
    $Group_Game_Map = GUICtrlCreateGroup("", 248, 0, 2000, 2000)

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

    Dim $MapPos[2]
    $MapPos[0] = 248
    $MapPos[1] = 0

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

    __CreateGameMap()

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

    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    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

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

    If _IsPressed(41) Then
    $MapPos[0] -= 10
    GUICtrlSetPos($Group_Game_Map,$MapPos[0],$MapPos[1])
    EndIf
    WEnd

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

    Func __CreateGameMap()
    ;Pos Count
    $x = 1
    $y = 1
    Dim $Feld[100][101][3]
    while $y <= 15
    If $x <= 50 And $x > 0 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 248 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 70 And $x > 50 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_blue.bmp", 248 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 85 And $x > 70 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 248 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 100 And $x > 85 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 248 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    $x += 1
    If $x = 100 Then
    $x = 1
    $y += 1
    EndIf
    WEnd
    while $y <= 20
    If $x <= 50 And $x > 0 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 248 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 70 And $x > 50 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_blue.bmp", 248 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 100 And $x > 70 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 248 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    $x += 1
    If $x = 100 Then
    $x = 1
    $y += 1
    EndIf
    WEnd
    while $y <= 30
    If $x <= 5 And $x > 0 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 248 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 35 And $x > 5 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_gray.bmp", 248 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 50 And $x > 35 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 248 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 70 And $x > 50 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_blue.bmp", 248 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 70 And $x > 100 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 248 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    $x += 1
    If $x = 100 Then
    $x = 1
    $y += 1
    EndIf
    WEnd
    while $y <= 50
    If $x <= 50 And $x > 0 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 248 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 100 And $x > 50 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_blue.bmp", 248 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    $x += 1
    If $x = 100 Then
    $x = 1
    $y += 1
    EndIf
    WEnd
    while $y <= 65
    If $x <= 100 And $x > 0 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 248 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    $x += 1
    If $x = 100 Then
    $x = 1
    $y += 1
    EndIf
    WEnd
    while $y <= 95
    If $x <= 35 And $x > 0 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_blue.bmp", 248 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 70 And $x > 35 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 248 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 85 And $x > 70 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_gray.bmp", 248 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 100 And $x > 85 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 248 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    $x += 1
    If $x = 100 Then
    $x = 1
    $y += 1
    EndIf
    WEnd
    while $y <= 100
    If $x <= 30 And $x > 0 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_blue.bmp", 248 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 70 And $x > 100 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 248 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    $x += 1
    If $x = 100 Then
    $x = 1
    $y += 1
    EndIf
    WEnd
    EndFunc

    [/autoit]
  • Ich denke du solltest dir am besten mal die GDI+ Funktionen anschauen

    Das finden von Rechtschreibfehlern muss sofort und unverzüglich dem Autor gemeldet werden. Das eigennützige Verwenden dieser Rechtschreibfehler ist strengstens untersagt und kann mit Freiheitsenzug bestraft werden.

  • Hallo M☻x,

    nimm eine ChildGui

    Spoiler anzeigen
    [autoit]

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

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

    Dim $idRadio2[5], $iLeft= 235, $iTop = 25
    #region ### START Koda GUI section ### Form=

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

    $Form1 = GUICreate("Form1", 441, 241, 50, 69)
    $btnHide = GUICtrlCreateButton('&verstecken', 20, 50, 100, 21)
    GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKLEFT + $GUI_DOCKTOP)

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

    $btnShow = GUICtrlCreateButton('&Zeigen', 20, 80, 100, 21)
    GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKLEFT + $GUI_DOCKTOP)
    $hGuiChild = GUICreate("", 170, 170, $iLeft, $iTop, $WS_CHILD, Default, $Form1)
    For $i = 0 To 4
    $idRadio2[$i] = GUICtrlCreateRadio("Radio " & $i, 5, $i * 25, 60, 18)
    Next
    GUISwitch($Form1)
    $hbtnLeft = GUICtrlCreateButton('&Links', 20, 120, 100, 21)
    $hbtnRight = GUICtrlCreateButton('&Rechts', 20, 150, 100, 21)
    GUISetState(@SW_SHOW, $Form1)
    GUISetState(@SW_SHOW, $hGuiChild)
    #endregion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $hbtnLeft
    $iLeft -= 5
    WinMove($hGuiChild,"",$iLeft,$iTop)
    Case $hbtnRight
    $iLeft += 5
    WinMove($hGuiChild,"",$iLeft,$iTop)
    Case $btnHide
    GUISetState(@SW_HIDE, $hGuiChild)
    Case $btnShow
    GUISetState(@SW_SHOW, $hGuiChild)
    EndSwitch
    WEnd

    [/autoit]

    mfg autoBert

  • so ich hab noch eine frage zu den ChildGui , und zwar möchte ich das in dem eigentlichen Gui zwei childguis sind und zwar eins für das menü und eins für die eigentliche karte nun soll das menü über der karte sein sodass die karte beim bewegen unter dem menü landet . habs mit menü auf $WS_EX_TOPMOST probiert geht aber irgend wie nicht.

    hier der code (und mit dazugehörigen bildern im anhang)

    Spoiler anzeigen
    [autoit]

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

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

    ;Hilfsvariablen
    Global Const $Ctrl = 1
    Global Const $Colision = 2

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

    Dim $MapPos[2]
    $MapPos[0] = 300
    $MapPos[1] = 10

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

    #region ### START Koda GUI section ### Form=
    ; Note : auflösung auf 1280x720 setzen und danach zurück für fullscreenmode
    $Form_Game = GUICreate("Game", 1280, 720, -1, -1)
    $Form_Game_Map = GUICreate("", 2000, 2000, 300, 10, $WS_CHILD, Default, $Form_Game)

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

    __CreateGameMap()

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

    GUISwitch($Form_Game)
    $Form_Game_Menu = GUICreate("", 300, 720, 0, 0, BitOR($WS_CHILD,$WS_EX_TOPMOST), Default, $Form_Game)
    GUICtrlCreateGroup("Menü",5,5,290,690)

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

    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUISwitch($Form_Game)
    GUISetState(@SW_SHOW, $Form_Game)
    GUISetState(@SW_SHOW, $Form_Game_Menu)
    GUISetState(@SW_SHOW, $Form_Game_Map)
    #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
    If _IsPressed("41") Then ; A
    $MapPos[0] += 10
    WinMove($Form_Game_Map,"",$MapPos[0],$MapPos[1])
    EndIf
    If _IsPressed("44") Then ; D
    $MapPos[0] -= 10
    WinMove($Form_Game_Map,"",$MapPos[0],$MapPos[1])
    EndIf
    If _IsPressed("57") Then ; W
    $MapPos[1] += 10
    WinMove($Form_Game_Map,"",$MapPos[0],$MapPos[1])
    EndIf
    If _IsPressed("53") Then ; S
    $MapPos[1] -= 10
    WinMove($Form_Game_Map,"",$MapPos[0],$MapPos[1])
    EndIf

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

    WEnd

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

    Func __CreateGameMap()
    ;Pos Count
    $x = 1
    $y = 1
    Dim $Feld[100][101][3]
    while $y <= 15
    If $x <= 50 And $x > 0 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 5 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 70 And $x > 50 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_blue.bmp", 5 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 85 And $x > 70 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 5 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 100 And $x > 85 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_gray.bmp", 5 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    $x += 1
    If $x = 100 Then
    $x = 1
    $y += 1
    EndIf
    WEnd
    while $y <= 20
    If $x <= 50 And $x > 0 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 5 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 70 And $x > 50 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_blue.bmp", 5 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 100 And $x > 70 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 5 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    $x += 1
    If $x = 100 Then
    $x = 1
    $y += 1
    EndIf
    WEnd
    while $y <= 30
    If $x <= 5 And $x > 0 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 5 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 35 And $x > 5 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_gray.bmp", 5 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 50 And $x > 35 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 5 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 70 And $x > 50 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_blue.bmp", 5 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 100 And $x > 70 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 5 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    $x += 1
    If $x = 100 Then
    $x = 1
    $y += 1
    EndIf
    WEnd
    while $y <= 50
    If $x <= 50 And $x > 0 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 5 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 100 And $x > 50 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_blue.bmp", 5 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    $x += 1
    If $x = 100 Then
    $x = 1
    $y += 1
    EndIf
    WEnd
    while $y <= 65
    If $x <= 100 And $x > 0 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 5 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    $x += 1
    If $x = 100 Then
    $x = 1
    $y += 1
    EndIf
    WEnd
    while $y <= 95
    If $x <= 35 And $x > 0 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_blue.bmp", 5 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 70 And $x > 35 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 5 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 85 And $x > 70 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_gray.bmp", 5 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 100 And $x > 85 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 5 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    $x += 1
    If $x = 100 Then
    $x = 1
    $y += 1
    EndIf
    WEnd
    while $y <= 100
    If $x <= 35 And $x > 0 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_blue.bmp", 5 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    If $x <= 100 And $x > 35 Then $Feld[$x][$y][$Ctrl] = GUICtrlCreatePic(@ScriptDir & "\SKIN_full_green.bmp", 5 + (($x - 1) * 20), 5 + (($y - 1) * 20), 20, 20)
    $x += 1
    If $x = 100 Then
    $x = 1
    $y += 1
    EndIf
    WEnd
    EndFunc

    [/autoit]


    EDIT2: hab das probelm gelöst indem ich das menü fenster vor der map erstellt hab

    2 Mal editiert, zuletzt von M☻x (30. November 2010 um 06:49)