Пример #1
0
        private void OnPctbClick(object sender, MouseEventArgs e)
        {
            var pctb     = (PictureBox)tbcMain.SelectedTab.Controls[0];
            var ti       = TileHandler.GetTileImage((TileTab)tbcMain.SelectedIndex);
            var tileSize = ti.TileSize;
            var xStart   = pctb.Width / 2 - TileHandler.GetWidth((TileTab)tbcMain.SelectedIndex) / 2;
            var yStart   = pctb.Height / 2 - TileHandler.GetHeight((TileTab)tbcMain.SelectedIndex) / 2;
            int xPos     = (e.X - xStart) / tileSize;
            int yPos     = (e.Y - yStart) / tileSize;

            TileHandler.SelectTile(xPos, yPos, (TileTab)tbcMain.SelectedIndex, e.Clicks);

            lblSelectedTile.Text = "Selected Tile: " + TileHandler.SelectedTile;
            //Init the selected tile neighbor test.
            pctb.Invalidate();
            ReloadSelectedTilesPanel();
        }