Esempio n. 1
0
        //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ColorRing_Start >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

        private void ColorRing_MouseMove(object sender, MouseEventArgs e)
        {
            if (_lockarea != LockArea.InRing)
            {
                return;
            }
            if (!((e.X == 850) && (e.Y == 116)))
            {
                H = Math.Atan2((double)(116 - e.Y), (double)(e.X - 850));//求出色相的degree
                H = H / Math.PI * 180 - 90;
                if (H < 0)
                {
                    H = H + 360;
                }
            }
            Draw_SV_Matrix();
            //=======================繪製結束=====================================================
            Color cr_temp = bm_temp.GetPixel(Poolpoint_Lock_on.X, Poolpoint_Lock_on.Y);

            _brush.Color = Color.FromArgb(_brush.Color.A, cr_temp.R, cr_temp.G, cr_temp.B);
            PenColorDisplay.BackColor = _brush.Color;

            Red.Value   = _brush.Color.R;
            Green.Value = _brush.Color.G;
            Blue.Value  = _brush.Color.B;

            R_val.Text = _brush.Color.R.ToString();
            G_val.Text = _brush.Color.G.ToString();
            B_val.Text = _brush.Color.B.ToString();

            ColorRing.Invalidate();

            ColorPool.Image = bm_temp;
        }
Esempio n. 2
0
        private void B_val_TextChanged(object sender, EventArgs e)
        {
            if ((_lockarea == LockArea.InPool) || (_lockarea == LockArea.InRing))
            {
                return;
            }
            int b_temp = 0;

            if (B_val.Text != "")
            {
                if (EnterPressed)
                {
                    EnterPressed = false;
                    label1.Focus();
                    return;
                }
                try{
                    b_temp = int.Parse(B_val.Text);
                    //輸入為數字
                    if (b_temp > 255)
                    {
                        B_val.Text = "255"; return;
                    }
                    else if (b_temp < 0)
                    {
                        B_val.Text = "0"; return;
                    }
                }
                catch { B_val.Text = _brush.Color.B.ToString(); return; }
            }
            //筆刷顏色更改後的相關處理
            _brush.Color = Color.FromArgb(_brush.Color.A, _brush.Color.R, _brush.Color.G, b_temp);
            Blue.Value   = b_temp;
            PenColorDisplay.BackColor = _brush.Color;
            RGB_to_HSV();

            bool HueChanged = RGB_to_HSV();

            Draw_SV_Matrix();

            if (HueChanged)
            {
                ColorRing.Invalidate();
            }
            ColorPool.Image = bm_temp;
        }
Esempio n. 3
0
        private void Board_Load(object sender, EventArgs e)
        {
            _mode            = Mode.Pencil;
            Pencil.BackColor = Pencil.FlatAppearance.MouseDownBackColor;
            bm_temp.SetResolution(192, 192);
            Poolpoint_Lock_on = new Point((int)(bm_temp_Size - 1), 0);
            H = 0;

            Draw_SV_Matrix();
            //=======================繪製結束=====================================================
            _brush.Color = bm_temp.GetPixel(Poolpoint_Lock_on.X, Poolpoint_Lock_on.Y);
            PenColorDisplay.BackColor = _brush.Color;

            ColorRing.Invalidate();

            ColorPool.Image = bm_temp;

            this.Controls.Add(Hana);
            Hana.BringToFront();
            Hana.MouseMove  += this.HanaPanel_MouseMove;
            Hana.MouseClick += this.HanaPanel_MouseClick;
            Hana.MouseDown  += this.HanaPanel_MouseDown;
            Hana.MouseUp    += this.HanaPanel_MouseUp;
            Hana.MouseEnter += this.HanaPanel_MouseEnter;
            Hana.MouseLeave += this.HanaPanel_MouseLeave;
            Hana.Paint      += this.HanaPanel_Paint;

            using (Graphics gp = Graphics.FromImage(cursor_P_Bitmap)){
                gp.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                gp.FillEllipse(CursorBrush, 25 - _brush.Width / 2, 25 - _brush.Width / 2, 1, 1);
            }
            using (Graphics ge = Graphics.FromImage(cursor_E_Bitmap)){
                ge.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                ge.FillEllipse(CursorBrush, 25 - _eraser.Width / 2, 25 - _eraser.Width / 2, 1, 1);
            }
            cursor_Pencil = new Cursor(cursor_P_Bitmap.GetHicon());
            cursor_Eraser = new Cursor(cursor_E_Bitmap.GetHicon());

            ColorRingBgImageClone = (Bitmap)ColorRing.BackgroundImage.Clone();; //複製一份色池的圖片,擷取顏色用
        }