Exemplo n.º 1
0
        private void picPalette_MouseDown(object sender, MouseEventArgs e)
        {
            float xPos = (float)e.X / picPalette.Width;
            float yPos = (float)e.Y / picPalette.Height;

            float y = yPos < 0.5 ? yPos : (yPos - 0.5f);
            float x = yPos < 0.5 ? xPos : (xPos + 1);

            int offset = (int)(x * 8) + (int)(y * 8) * 16;

            ColorClick?.Invoke(offset);
        }
Exemplo n.º 2
0
        private void CreateColorPanel()
        {
            ColorList colorList = bmp.colorCountList;

            for (int i = 0; i < colorList.Count; i++)
            {
                if (colorList[i].ColorCount == 0)
                {
                    continue;
                }
                colorCount++;
                Panel p = new Panel();
                p.Width  = 130;
                p.Height = 16;
                //p.BackColor = colors[i];

                Panel p1 = new Panel();
                p1.Width     = 16;
                p1.Height    = 16;
                p1.BackColor = colorList[i].Brush.Color;
                p1.Tag       = colorList[i].Tag;
                p1.Cursor    = Cursors.Hand;
                if (!string.IsNullOrEmpty(colorList[i].Name))
                {
                    toolTip1.SetToolTip(p1, colorList[i].Name);
                }
                p1.Click += (s, e) => { ColorClick?.Invoke(p1, this.bmp); };
                p.Controls.Add(p1);


                Label l = new Label();
                l.Width     = 114;
                l.Height    = 16;
                l.Left      = 18;
                l.TextAlign = ContentAlignment.MiddleLeft;
                l.AutoSize  = false;
                l.Text      = colorList[i].ColorCount.ToString();
                p.Controls.Add(l);


                flowLayoutPanel1.Controls.Add(p);
            }
        }
Exemplo n.º 3
0
        public override void Update(Universe universe, Vector2 origin, AvatarController avatar, List <ScanCode> input, bool ctrl, bool shift, IReadOnlyList <InterfaceLogicalButton> inputPressed,
                                    Vector2 mouseLocation, bool click, bool clickHold)
        {
            if (!Window.CallUpdates && !Window.Visible)
            {
                return;
            }

            var location = Helpers.VectorLocation(origin,
                                                  new Vector2(origin.X + _colorWheel.Width, origin.Y + _colorWheel.Height),
                                                  mouseLocation);

            if (location.X == -1 || location.Y == -1)
            {
                return;
            }

            Color color;

            try {
                color = Helpers.GetColorByCoordinate(_colorWheel.GetTexture(null), location);
            } catch {
                return;
            }

            if (color == Color.Transparent)
            {
                return;
            }

            ColorHover?.Invoke(color);

            if (click || clickHold)
            {
                ColorClick?.Invoke(color);
            }
        }
Exemplo n.º 4
0
 void ColorPickup_MouseClick(object sender, MouseEventArgs e)
 {
     ColorClick?.Invoke(GetColor(new Point(e.X, e.Y)));
 }
Exemplo n.º 5
0
 protected virtual void OnColorClick(EventArgs e, ColorButton sender)
 {
     ColorClick?.Invoke(sender, e);
 }
Exemplo n.º 6
0
 public void OnColorClick(object sender, RibbonEventArgs e) =>
 ColorClick?.Invoke(sender, e);
Exemplo n.º 7
0
 protected virtual void OnColorClick(ButtonPressEventArgs e, object sender)
 {
     ColorClick?.Invoke(sender, e);
 }