Example #1
0
 protected virtual void OnBackColorChanged()
 {
     TextureValid = false;
     if (BackColorChanged != null)
     {
         BackColorChanged.Invoke(this, EventArgs.Empty);
     }
 }
Example #2
0
 private void UpdateSelection(byte idx)
 {
     if (PalSource == null) return;
     if (ModifierKeys == Keys.Alt)
     {
         BackColor = PalSource[idx];
         BackColorChanged?.Invoke(this, new EventArgs());
         return;
     }
     if (!IsSelectable) return;
     if (IsMultiSelect)
     {
         switch (ModifierKeys)
         {
             case Keys.Control:
                 if (Selections.Contains(idx)) Selections.Remove(idx);
                 else Selections.Add(idx);
                 break;
             case Keys.Shift:
                 if (Selections.Count == 0)
                 {
                     Selections.Add(idx);
                     break;
                 }
                 if (Selections.Last() == idx)
                 {
                     Selections.Remove(idx);
                 }
                 else
                 {
                     if (Selections.Last() < idx)
                     {
                         for (int i = Selections.Last() + 1; i <= idx; i++)
                             if (!Selections.Contains((byte)i)) Selections.Add((byte)i);
                     }
                     else
                     {
                         for (int i = Selections.Last() - 1; i >= idx; i--)
                             if (!Selections.Contains((byte)i)) Selections.Add((byte)i);
                     }
                 }
                 break;
             default:
                 Selections.Clear();
                 Selections.Add(idx);
                 break;
         }
     }
     else
     {
         Selections.Clear();
         Selections.Add(idx);
     }
     if (PalSource != null)
         SelectedIndexChanged?.Invoke(this, new EventArgs());
     if (IsSelectVisible) Refresh();
 }
Example #3
0
 protected internal virtual void OnBackColorChanged(EventArgs e)
 {
     BackColorChanged?.Invoke(this, e);
 }