Exemplo n.º 1
0
        private void SetPickedColor(Color pColor)
        {
            Bitmap cView = new Bitmap(colorBox.Width, colorBox.Height);

            using (Graphics g = Graphics.FromImage(cView))
            {
                g.Clear(pColor);
                using (SolidBrush sb = new SolidBrush(ColorUtils.Invert(pColor)))
                {
                    using (Pen p = new Pen(sb, 1))
                    {
                        g.DrawRectangle(p, new Rectangle(1, 1, cView.Width - 3, cView.Height - 3));
                    }
                }
            }

            HSLColor hlc = HSLColor.FromColor(pColor);
            HSVColor hvc = HSVColor.FromColor(pColor);
            RGBColor rgc = RGBColor.FromColor(pColor);
            HEXColor hxc = HEXColor.FromColor(pColor);

            lbl_HTML.Text = hxc.ToString();
            lbl_RGB.Text  = rgc.ToString();
            lbl_HSL.Text  = hlc.ToString();
            lbl_HSV.Text  = hvc.ToString();

            colorBox.Image?.Dispose();
            colorBox.Image = cView;
        }
Exemplo n.º 2
0
 private void lbl_HTML_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     Copy(HEXColor.FromColor(ldcPlate.SelectedColor));
 }
Exemplo n.º 3
0
        // 임시 핫키 세팅과 연동 필요함
        private void InitHotKey()
        {
            Keys[]  semi_hkKeys   = new Keys[] { Keys.Left, Keys.Right, Keys.Up, Keys.Down };
            Point[] semi_hkDeltas = new Point[] { new Point(-1, 0), new Point(1, 0), new Point(0, -1), new Point(0, 1) };

            for (int i = 0; i < semi_hkDeltas.Length; i++)
            {
                int idx = i;

                HotkeyManager.Register($"SEMI_{semi_hkKeys[idx].ToString()}", new HotKey()
                {
                    Keys   = new Keys[] { semi_hkKeys[idx] },
                    Action = () =>
                    {
                        if (setting.SemiControl)
                        {
                            Point acPt = Point.Empty;

                            if (HotkeyManager.IsShift())
                            {
                                acPt = new Point(semi_hkDeltas[idx].X * 3, semi_hkDeltas[idx].Y * 3);
                            }

                            SetCursorPosDelta(semi_hkDeltas[idx] + (Size)acPt);
                        }
                    }
                });
            }

            HotkeyManager.Register("Pause", new HotKey()
            {
                Keys   = new Keys[] { Keys.None, Keys.F1 },
                Action = () =>
                {
                    mPause = !mPause;
                }
            });

            HotkeyManager.Register("ZoomIn", new HotKey()
            {
                Keys   = new Keys[] { Keys.None, Keys.Add },
                Action = () =>
                {
                    zoomSlider.Value += 1;
                }
            });

            HotkeyManager.Register("ZoomOut", new HotKey()
            {
                Keys   = new Keys[] { Keys.None, Keys.Subtract },
                Action = () =>
                {
                    zoomSlider.Value -= 1;
                }
            });

            HotkeyManager.Register("RGB", new HotKey()
            {
                Keys   = new Keys[] { Keys.None, Keys.F2 },
                Action = () =>
                {
                    AddColor(RGBColor.FromColor(ldcPlate.SelectedColor));
                }
            });

            HotkeyManager.Register("HEX", new HotKey()
            {
                Keys   = new Keys[] { Keys.None, Keys.F3 },
                Action = () =>
                {
                    AddColor(HEXColor.FromColor(ldcPlate.SelectedColor));
                }
            });

            HotkeyManager.Register("HSL", new HotKey()
            {
                Keys   = new Keys[] { Keys.None, Keys.F4 },
                Action = () =>
                {
                    AddColor(HSLColor.FromColor(ldcPlate.SelectedColor));
                }
            });

            HotkeyManager.Register("HSB", new HotKey()
            {
                Keys   = new Keys[] { Keys.None, Keys.F5 },
                Action = () =>
                {
                    AddColor(HSVColor.FromColor(ldcPlate.SelectedColor));
                }
            });
        }