Hej,Collection problem.. igen
Jag har lekt runt lite med collection funktionen till lite hobby-projekt. problemet är om jag matar in olika structer i collectionen kan jag inte få ut dem.
Dim Rect As Rectangle
Dim iTile As Tile
Dim cInfo As InfoCharacter
Dim oInfo As InfoObject
Dim bInfo As InfoBackGround
Dim dDr As New Bitmap(PictureBox1.Width, PictureBox1.Height)
dDr = New Bitmap(PictureBox1.Width, PictureBox1.Height)
AddGrid(dDr)
Dim GraphBack As Graphics = Graphics.FromImage(dDr)
For Each bInfo In Map
iTile = CType(TileRect(bInfo.RectangleC), Tile)
Rect = CType(iTile.Rect(1), Rectangle)
GraphBack.DrawImage(iTile.Pic, New Rectangle(bInfo.Location.X, bInfo.Location.Y, Rect.Width, Rect.Height), Rect, GraphicsUnit.Pixel)
Next
For Each cInfo In Map
iTile = CType(TileRect(cInfo.RectangleC), Tile)
Rect = CType(iTile.Rect(1), Rectangle)
GraphBack.DrawImage(iTile.Pic, New Rectangle(cInfo.Location.X, cInfo.Location.Y, Rect.Width, Rect.Height), Rect, GraphicsUnit.Pixel)
Next
For Each oInfo In Map
iTile = CType(TileRect(oInfo.RectangleC), Tile)
Rect = CType(iTile.Rect(1), Rectangle)
GraphBack.DrawImage(iTile.Pic, New Rectangle(oInfo.Location.X, oInfo.Location.Y, Rect.Width, Rect.Height), Rect, GraphicsUnit.Pixel)
Next
Om någon orkade titta igenom koden ovan, så är iaf problemet att om oInfo stötter på en collection del som har annan data än just oInfo skriker programmet till. Hur skall jag göra?