private void addSpriteButton_Click(object sender, EventArgs e) { var dialog = new OpenFileDialog(); dialog.Title = "Browse sprite files"; dialog.DefaultExt = "png"; dialog.Filter = "image file (*.png, *.jpg, *.jpeg)|*.png;*.jpg;*.jpeg"; if (dialog.ShowDialog() != DialogResult.OK) { return; } var spriteDialog = new AddSpriteDialog(this, dialog.FileName); if (spriteDialog.ShowDialog() != DialogResult.OK) { return; } var createdSprite = spriteDialog.Template; this.Sprite.Add(createdSprite.Name, createdSprite); var item = this._spriteListView.Items.Add(createdSprite.Name); item.SubItems.Add(createdSprite.Threshold.ToString("0.00")); item.SubItems.Add(createdSprite.Bytes.Length.ToString()); item.Tag = createdSprite; }
private void modifySpriteButton_Click(object sender, EventArgs e) { try { var selectedItem = this._spriteListView.SelectedItems[0]; var sprite = selectedItem.Tag as Sprite.Template; var spriteDialog = new AddSpriteDialog(this, sprite); if (spriteDialog.ShowDialog() != DialogResult.OK) { return; } selectedItem.Text = sprite.Name; } catch (Exception exc) { MessageBox.Show(exc.Message); } }