Example #1
0
        public void UpdateColors(COLOR e)
        {
            preventOverflow = true;

            cp_ColorPickerMain.SelectedColor = e;

            nudAlphaValue.Value = e.A;

            ccb_RGB.UpdateColor(e);
            ccb_HSB.UpdateColor(e);
            ccb_HSL.UpdateColor(e);
            ccb_CMYK.UpdateColor(e);

            if (e.isTransparent)
            {
                tb_HexDisplay.Text     = ColorHelper.ColorToHex(e, ColorFormat.ARGB);
                tb_DecimalDisplay.Text = ColorHelper.ColorToDecimal(e, ColorFormat.ARGB).ToString();
            }
            else
            {
                tb_HexDisplay.Text     = ColorHelper.ColorToHex(e, ColorFormat.RGB);
                tb_DecimalDisplay.Text = ColorHelper.ColorToDecimal(e, ColorFormat.RGB).ToString();
            }

            cd_ColorDisplayMain.CurrentColor = e;

            preventOverflow = false;
        }
Example #2
0
        private void ToolTipTimer_Tick(object sender, EventArgs e)
        {
            toolTipTimer.Stop();

            if (!ShowToolTip)
            {
                return;
            }

            Point  p           = new Point();
            string tooltipText = $"#{ColorHelper.ColorToHex(currentColor)}\n#{ColorHelper.ColorToHex(lastColor)}";

            switch (ShowToolTipAt)
            {
            case ToolTipLocation.Mouse:
                p = PointToClient(Cursor.Position);

                // need to offset to prevent the OnMouseLeave from removing tooltip
                p.X += 1;
                p.Y += 1;
                break;

            case ToolTipLocation.ControlBottom:
                p = new Point(ClientRectangle.X, ClientRectangle.Y + ClientSize.Height);
                break;

            case ToolTipLocation.ControlTop:
                // close enough idc enough to make it perfect cause idk what the
                // tooltip font is and i don't know where to find it

                p = new Point(ClientRectangle.X, ClientRectangle.Y - TextRenderer.MeasureText(tooltipText, this.Font).Height);
                break;

            case ToolTipLocation.ControlLeft:
                // close enough idc enough to make it perfect cause idk what the
                // tooltip font is and i don't know where to find it

                p = new Point(ClientRectangle.X - TextRenderer.MeasureText(tooltipText, this.Font).Width, ClientRectangle.Y);
                break;

            case ToolTipLocation.ControlRight:
                p = new Point(ClientRectangle.X + ClientSize.Width, ClientRectangle.Y);
                break;
            }

            if (p != Point.Empty)
            {
                tt_Main.Show(tooltipText, this, p);
                return;
            }
        }
Example #3
0
 public string ToHex(ColorFormat format = ColorFormat.RGB)
 {
     return(ColorHelper.ColorToHex(ARGB.R, ARGB.G, ARGB.B, ARGB.A, format));
 }