Exemple #1
0
        private void CreateSpriteControl(ArtSprite sprite)
        {
            SpriteControl newSpriteControl = new SpriteControl();

            newSpriteControl.OnSpriteSelected += SpriteSelectedHandler;
            newSpriteControl.Sprite            = sprite;
            panelSprites.Controls.Add(newSpriteControl);
        }
Exemple #2
0
        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));
                }
            }
        }
Exemple #3
0
        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));
            }
        }