Exemplo n.º 1
0
        public RuneDisplayElement(Rune rune, bool highContrast, bool removable, bool haveRune)
        {
            Rune = rune;
            using (Bitmap sprite = highContrast ? Properties.Resources.runes_high_contrast : Properties.Resources.runes)
            {
                image    = sprite.Clone(new Rectangle(0, (int)Rune * RuneSize, RuneSize, RuneSize), sprite.PixelFormat);
                imageRed = sprite.Clone(new Rectangle(RuneSize, (int)Rune * RuneSize, RuneSize, RuneSize), sprite.PixelFormat);
            }

            pictureBox1          = new PictureBox();
            pictureBox1.Location = new Point(0, 0);
            pictureBox1.Margin   = new Padding(0);
            pictureBox1.Size     = new Size(RuneSize, RuneSize);

            SetHaveRune(haveRune);

            Controls.Add(pictureBox1);

            if (removable)
            {
                var btnRemove = new Button();
                btnRemove.Location = new Point(36, 3);
                btnRemove.Size     = new Size(17, 23);
                btnRemove.Text     = "X";
                btnRemove.Click   += (object s, EventArgs e) => RemoveButtonClicked?.Invoke(this, e);
                Controls.Add(btnRemove);
            }

            // twice as wide if removable, cause of remove button
            Size = new Size(RuneSize * (removable ? 2 : 1), RuneSize);

            Disposed += OnDisposed;
        }
Exemplo n.º 2
0
        private void RemoveEmotionButton_Click(object sender, RoutedEventArgs e)
        {
            Button clickedButton = (Button)sender;
            var    emotion       = (Emotion)clickedButton.DataContext;

            RemoveButtonClicked?.Invoke(this, new RemoveEmotionButtonClickedEventArgs(emotion));
        }
 protected virtual void OnRemoveButtonClicked()
 {
     RemoveButtonClicked?.Invoke();
 }
Exemplo n.º 4
0
 void RemoveButtonOnClick(object sender, EventArgs e)
 {
     RemoveButtonClicked?.Invoke(this, e);
 }
 private void ButtonX_Remove_Click(object sender, EventArgs e)
 {
     RemoveButtonClicked?.Invoke(this);
 }
 private void RemoveBtn_Click(object sender, EventArgs e)
 {
     RemoveButtonClicked.Invoke(sender, e);
 }