コード例 #1
0
ファイル: ColorButton.cs プロジェクト: tomyqg/CSHomework
 public void ShowColorDialog()
 {
     using (ColorPickerForm dialogColor = new ColorPickerForm(Color))
     {
         if (dialogColor.ShowDialog() == DialogResult.OK)
         {
             Color = dialogColor.NewColor;
         }
     }
 }
コード例 #2
0
ファイル: MonitorTestForm.cs プロジェクト: sisco035/ShareX
 private void btnColorDialog_Click(object sender, EventArgs e)
 {
     using (ColorPickerForm dialogColor = new ColorPickerForm(Color.FromArgb(tbRed.Value, tbGreen.Value, tbBlue.Value)))
     {
         if (dialogColor.ShowDialog() == DialogResult.OK)
         {
             Color color = dialogColor.NewColor;
             tbRed.Value   = color.R;
             tbGreen.Value = color.G;
             tbBlue.Value  = color.B;
             DrawRedGreenBlue();
         }
     }
 }
コード例 #3
0
        public static bool PickColor(Color currentColor, out Color newColor, Form owner = null)
        {
            using (ColorPickerForm dialog = new ColorPickerForm(currentColor))
            {
                if (dialog.ShowDialog(owner) == DialogResult.OK)
                {
                    newColor = dialog.NewColor;
                    return(true);
                }
            }

            newColor = currentColor;
            return(false);
        }
コード例 #4
0
ファイル: ColorPickerForm.cs プロジェクト: scfunknown/ShareX
        public static Color GetColor(Color currentColor)
        {
            using (ColorPickerForm dialog = new ColorPickerForm(currentColor))
            {
                dialog.rbSaturation.Checked = true;

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    return(dialog.NewColor);
                }
            }

            return(currentColor);
        }
コード例 #5
0
ファイル: ColorPickerForm.cs プロジェクト: wazerstar/ShareX
        public static bool PickColor(Color currentColor, out Color newColor, Form owner = null, Func <PointInfo> openScreenColorPicker = null)
        {
            using (ColorPickerForm dialog = new ColorPickerForm(currentColor))
            {
                if (openScreenColorPicker != null)
                {
                    dialog.EnableScreenColorPickerButton(openScreenColorPicker);
                }

                if (dialog.ShowDialog(owner) == DialogResult.OK)
                {
                    newColor = dialog.NewColor;
                    return(true);
                }
            }

            newColor = currentColor;
            return(false);
        }