示例#1
0
        private void m_lbl_SelectedColor_Click(object sender, System.EventArgs e)
        {
            frmColorPicker ColorDialog = new frmColorPicker(m_lbl_SelectedColor.BackColor);

            ColorDialog.DrawStyle = m_eDrawStyle;
            if (ColorDialog.ShowDialog() == DialogResult.OK)
            {
                //	Display the color
                m_lbl_SelectedColor.BackColor = ColorDialog.PrimaryColor;

                //	Display the color hex value
                string red = Convert.ToString(m_lbl_SelectedColor.BackColor.R, 16);
                if (red.Length < 2)
                {
                    red = "0" + red;
                }
                string green = Convert.ToString(m_lbl_SelectedColor.BackColor.G, 16);
                if (green.Length < 2)
                {
                    green = "0" + green;
                }
                string blue = Convert.ToString(m_lbl_SelectedColor.BackColor.B, 16);
                if (blue.Length < 2)
                {
                    blue = "0" + blue;
                }

                m_lbl_HexColor.Text = "#" + red.ToUpper() + green.ToUpper() + blue.ToUpper();
                m_lbl_HexColor.Update();

                m_eDrawStyle = ColorDialog.DrawStyle;
            }
        }
示例#2
0
        private void btnBkgColorChange_Click(object sender, EventArgs e)
        {
            var colorPicker = new frmColorPicker(boxBkgColor.BackColor);

            if (colorPicker.ShowDialog(this) == DialogResult.OK)
            {
                boxBkgColor.BackColor = colorPicker.PrimaryColor;
            }
        }
示例#3
0
 public override void UpdateData()
 {
     if (_get == null) return;
     if (colorPicker != null && !colorPicker.Visible)
     {
         if (_set != null)
         {
             if (colorPicker.DialogResult == DialogResult.OK)
             {
                 colorValue = ToVector4(colorPicker.PrimaryColor);
             }
             else
             {
                 colorValue = oldColorValue;
             }
             pictureBox1.BackColor = ToColor(colorValue);
             _set(colorValue);
         }
         colorPicker.Dispose();
         colorPicker = null;
     }
     else
     {
         var newColor = _get();
         if (newColor != colorValue)
         {
             colorValue = newColor;
             alpha = MathUtil.Clamp((int)(newColor.W * 255), 0, 255);
             this.trackBar1.Value = alpha;
             this.pictureBox1.BackColor = ToColor(newColor);
         }
         if(alpha != this.trackBar1.Value)
         {
             alpha = this.trackBar1.Value;
             colorValue.W = (float)(alpha / 255.0);
         }
         if(colorPicker != null)
         {
             if(colorPickerColor != colorPicker.PrimaryColor)
             {
                 colorPickerColor = colorPicker.PrimaryColor;
                 pictureBox1.BackColor = colorPicker.PrimaryColor;
                 colorValue = ToVector4(colorPickerColor);
             }
             colorPickerLocation = colorPicker.DesktopLocation;
         }
         if (_set != null) _set(colorValue);
     }
 }
示例#4
0
        private void oldColorPreview_Click(object sender, EventArgs e)
        {
            using (frmColorPicker picker = new frmColorPicker(oldColorPreview.BackColor))
            {
                DialogResult result = picker.ShowDialog();

                if (result == DialogResult.Cancel)
                {
                    return;
                }

                oldColorPreview.BackColor = picker.PrimaryColor;
                oldColorCode.Text         = Editor.toHexColor(picker.PrimaryColor);
            }
        }
        private Color ColorPicker(Color color)
        {
            Color newColor = Color.Transparent;

            using (frmColorPicker ColorDialog = new frmColorPicker(color))
            {
                ColorDialog.DrawStyle = drawStyle;
                if (ColorDialog.ShowDialog() == DialogResult.OK)
                {
                    //	Display the color
                    newColor = ColorDialog.PrimaryColor;

                    drawStyle = ColorDialog.DrawStyle;
                }
            }

            return(newColor);
        }
示例#6
0
        private void TempTextBox_DoubleClick(object sender, EventArgs e)
        {
            if (sender is TextBox)
            {
                switch (((TextBox)sender).Tag.ToString())
                {
                case null:

                    break;

                case "rgb":
                    frmColorPicker picker = new frmColorPicker(((TextBox)sender).BackColor);
                    picker.Text = "[L2Ninja] Select RGB Color";
                    picker.ShowDialog();
                    ((TextBox)sender).BackColor = picker.PrimaryColor;
                    ((TextBox)sender).Text      = ColorTranslator.ToHtml(picker.PrimaryColor).Substring(1);
                    break;
                }
            }
        }
示例#7
0
                /// <summary>
                /// 
                /// </summary>
                /// <param name="customIndex"></param>
                protected virtual void LaunchDialog(int customIndex)
                {
                    base.Invalidate();

                    frmColorPicker colorDialog = new frmColorPicker(this.GetColorFromCell(customIndex));

                    this.editor.ColorDialog = colorDialog;

                    if (colorDialog.ShowDialog(this.editor.EditingTable.FindForm()) == DialogResult.OK)
                    {
                        this.colors[customIndex] = colorDialog.PrimaryColor;
                        this.SelectedColor = this.colors[customIndex];
                        this.OnPicked(EventArgs.Empty);
                    }

                    this.editor.ColorDialog = null;
                }
示例#8
0
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     if (colorPicker == null)
     {
         if(colorPickerLocation.IsEmpty)
         {
             colorPickerLocation = pictureBox1.PointToScreen(new System.Drawing.Point(-200, -200));
         }
         oldColorValue = colorValue;
         colorPicker = new frmColorPicker(pictureBox1.BackColor);
         colorPicker.Show();
         colorPicker.DesktopLocation = colorPickerLocation;
     }
     else
     {
         colorPicker.BringToFront();
     }
 }
示例#9
0
    private void btnColorPicker_Click(object sender, EventArgs e)
    {
        frmColorPicker f = new frmColorPicker();

        f.ShowDialog();
    }