コード例 #1
0
        /// <summary>
        /// Handles the double clicking on the control.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnDoubleClick(System.EventArgs e)
        {
            Point absolute   = Cursor.Position;
            Point relative   = PointToClient(absolute);
            Point gridCoords = this.GridPainter.TranslateScreenCoordinatesToGridCoordinates(relative);

            if (gridCoords == Point.Empty)
            {
                return;
            }

            GridCell gridCell = this.Grid.GetCell(gridCoords);

            if (gridCell.City != null)
            {
                CityDialog cityDetailWindow;

                cityDetailWindow = new CityDialog(gridCell.City);
                cityDetailWindow.ShowDialog(this);
            }
            else
            {
                TerrainDialog dlg = new TerrainDialog(gridCell);
                dlg.ShowDialog(this);
            }

            base.OnDoubleClick(e);
        }
コード例 #2
0
        private void HandleTerrainInfoClick(object sender, System.EventArgs e)
        {
            Point absolute   = Cursor.Position;
            Point relative   = PointToClient(absolute);
            Point gridCoords = this.GridPainter.TranslateScreenCoordinatesToGridCoordinates(relative);

            if (gridCoords == Point.Empty)
            {
                return;
            }

            GridCell      gridCell = this.Grid.GetCell(gridCoords);
            TerrainDialog dlg      = new TerrainDialog(gridCell);

            dlg.ShowDialog(this);
        }