//Open a tile attributes dialog.
        protected override void btnTileAttributes_Click(object sender, EventArgs e)
        {
            TileAttributes TA = new TileAttributes(TerrainTypeIndex);

            if (TA.ShowDialog() == DialogResult.OK)
            {//Set the current tile attributes based on the TileAttibutes return.
                TerrainTypeIndex = TA.TerrainTypeIndex;
            }
        }
            public void EditTerrain(int X, int Y, int LayerIndex)
            {
                TerrainConquest SelectedTerrain = ActiveMap.GetTerrain(X, Y, LayerIndex);
                TileAttributes  TA = new TileAttributes(new TerrainConquest(SelectedTerrain));

                if (TA.ShowDialog() == DialogResult.OK)
                {
                    ReplaceTerrain(X, Y, new TerrainConquest(X, Y, SelectedTerrain.TerrainTypeIndex), LayerIndex);
                }
            }