/// <summary> /// Creates a new TileDialog to represent an already-created Tile /// </summary> /// <param name="parent">The MainForm that created the dialog</param> /// <param name="imageDirectory">The directory to start looking for our tile images in</param> /// <param name="tileContent">The tileContent corresponding to the tile we are representing</param> public TileDialog(MainForm parent, string imageDirectory, TileContent tileContent) : this(parent, imageDirectory) { this.FileName = tileContent.Image.Filename; textBoxName.Text = tileContent.Name; pictureBox1.ImageLocation = this.FileName; Tile = new Tile(); comboBoxType.SelectedItem = tileContent.TileType; }
/// <summary> /// Event handler for double-clicking a tile in the tile palette. /// This brings up a properties editor dialog for the tile. /// </summary> void EditTileClicked(object sender, EventArgs e) { int index = tileListView.SelectedIndices[0]; TileContent tileContent = tilePalette[index]; // Create a new TileDialog TileDialog td = new TileDialog(this, tileImagePath, tileContent); // Set the TileDialog's Tile to the selected tile td.Tile = mapViewerControl.Tilemap.TilePalette[index]; if (td.ShowDialog() == DialogResult.OK) { // Swap the tile's name in the tileListView tileListView.Items[index].Text = td.Tile.Name; // Swap the tile's image in the tileImageList tileImageList.Images[index] = Bitmap.FromFile(td.FileName); // Swap the tile in the tilemap's tile palette tilemap.TilePalette[index] = td.Tile; // Swap the tile in the MainForm's tile palette tilePalette[index] = new TileContent(td.FileName) { Name = td.Tile.Name, TileType = td.Tile.TileType }; } }