private void CreateSpriteControl(ArtSprite sprite) { SpriteControl newSpriteControl = new SpriteControl(); newSpriteControl.OnSpriteSelected += SpriteSelectedHandler; newSpriteControl.Sprite = sprite; panelSprites.Controls.Add(newSpriteControl); }
public void DeleteCurrentSprite() { if (_selectedSprite != null) { _selectedSprite.OnSpriteSelected -= SpriteSelectedHandler; _file.Sprites.Remove(_selectedSprite.Sprite); panelSprites.Controls.Remove(_selectedSprite); _selectedSprite = null; if (OnSpriteSelected != null) { OnSpriteSelected(this, new OnSpriteSelectedEventArgs(-1, null)); } } }
private void SpriteSelectedHandler(object sender, OnSpriteSelectedEventArgs e) { int position; foreach (SpriteControl item in panelSprites.Controls) { if (item != sender) { item.Selected = false; } } _selectedSprite = (SpriteControl)sender; position = _file.Sprites.IndexOf(e.Sprite); if (OnSpriteSelected != null) { OnSpriteSelected(this, new OnSpriteSelectedEventArgs(position, e.Sprite)); } }