private void objTilePanel_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { Graphics Gfx = e.Graphics; if (objSetList.Items.Count < 1) { return; } int lIndex = mlSelectedTileSet; if (lIndex < 0) { return; } cTileSet TSetData = (cTileSet)mlstTileSets[lIndex]; int lTileSize = TSetData.mlTileSize; int lX = 0, lY = 0, lCount = 0; //Note lY at start should depend on the scroller! foreach (cTileData TData in TSetData.mlstTileData) { bool bHighLight = mlSelectedTile == lCount; TData.Draw(Gfx, lX, lY, true, bHighLight, 0); lX += lTileSize; if (lX >= objTilePanel.Width) { lX = 0; lY += lTileSize; } lCount++; } }