es geht sicher besser als so

Lifmor

Mitglied
Hab ein kleines Problem

Bevor wir zum problem kommen erst mal der code:

Code:
Select Case array(9, 2) 'image 1
        Case 11
            Set frmgame.Image1.Picture = LoadPicture(App.Path & "\img\withe_1.gif")
        Case 12
            Set frmgame.Image1.Picture = LoadPicture(App.Path & "\img\withe_2.gif")
        Case 13
            Set frmgame.Image1.Picture = LoadPicture(App.Path & "\img\withe_3.gif")
        Case 14
            Set frmgame.Image1.Picture = LoadPicture(App.Path & "\img\withe_4.gif")
        Case 15
            Set frmgame.Image1.Picture = LoadPicture(App.Path & "\img\withe_5.gif")
        Case 16
            Set frmgame.Image1.Picture = LoadPicture(App.Path & "\img\withe_6.gif")
        Case 21
            Set frmgame.Image1.Picture = LoadPicture(App.Path & "\img\black_1.gif")
        Case 22
            Set frmgame.Image1.Picture = LoadPicture(App.Path & "\img\black_2.gif")
        Case 23
            Set frmgame.Image1.Picture = LoadPicture(App.Path & "\img\black_3.gif")
        Case 24
            Set frmgame.Image1.Picture = LoadPicture(App.Path & "\img\black_4.gif")
        Case 25
            Set frmgame.Image1.Picture = LoadPicture(App.Path & "\img\black_5.gif")
        Case 26
            Set frmgame.Image1.Picture = LoadPicture(App.Path & "\img\black_6.gif")
        Case 0
            Set frmgame.Image1.Picture = LoadPicture()
    End Select

Select Case array(9, 3) 'image 2
        Case 11
            Set frmgame.Image2.Picture = LoadPicture(App.Path & "\img\withe_1.gif")
        Case 12
            Set frmgame.Image2.Picture = LoadPicture(App.Path & "\img\withe_2.gif")
        Case 13
            Set frmgame.Image2.Picture = LoadPicture(App.Path & "\img\withe_3.gif")
        Case 14
            Set frmgame.Image2.Picture = LoadPicture(App.Path & "\img\withe_4.gif")
        Case 15
            Set frmgame.Image2.Picture = LoadPicture(App.Path & "\img\withe_5.gif")
        Case 16
            Set frmgame.Image2.Picture = LoadPicture(App.Path & "\img\withe_6.gif")
        Case 21
            Set frmgame.Image2.Picture = LoadPicture(App.Path & "\img\black_1.gif")
        Case 22
            Set frmgame.Image2.Picture = LoadPicture(App.Path & "\img\black_2.gif")
        Case 23
            Set frmgame.Image2.Picture = LoadPicture(App.Path & "\img\black_3.gif")
        Case 24
            Set frmgame.Image2.Picture = LoadPicture(App.Path & "\img\black_4.gif")
        Case 25
            Set frmgame.Image2.Picture = LoadPicture(App.Path & "\img\black_5.gif")
        Case 26
            Set frmgame.Image2.Picture = LoadPicture(App.Path & "\img\black_6.gif")
        Case 0
            Set frmgame.Image2.Picture = LoadPicture()
    End Select
usw... das ganze mit 64 bildern.

Das Problem sollte nun bekannt sein.
Kann man das nicht irgendwie mit einer schleife kürzer machen? Das array mit einer schleife durchzugehen ist ja kein problem (for next)
aber wie kann ich dem programm beibringen dass es immer das bild wechseln soll?

Wäre froh wenn mir jemand helfen könnte.

MFG Lifmor
 
Da sich hier niemand erbarmt zu antworten.....hier der Code:
Code:
Set frmgame.Image1.Picture = LoadPicture(App.Path & "\img\withe_" & array(9, 2)-10 & ".gif")
 
Set frmgame.Image2.Picture = LoadPicture(App.Path & "\img\withe_" & array(9, 3)-10 & ".gif")
 
Benenne die Bilder doch einfach wie deine CaseIndexe. Dann kannst du mit mit einer Schleife die Bilder abfragen
 
Zurück