Example #1
0
        private Color SelectColor(string title, Rectangle bounds, Color color)
        {
            var location = PointToScreen(toolStrip.Location);

            using (var dialog = new ColorDialogEx(title,
                                                  location.X + bounds.Location.X,
                                                  location.Y + bounds.Height + 4))
            {
                dialog.Color = color;

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

            return(Color.Empty);
        }
Example #2
0
        private void ChooseCustomColor(object sender, EventArgs e)
        {
            if (initialized && customButton.Checked)
            {
                var location = PointToScreen(customButton.Location);

                using (var dialog = new ColorDialogEx("Page Color",
                                                      location.X + customButton.Bounds.Location.X + (customButton.Width / 2),
                                                      location.Y - 200))
                {
                    dialog.Color = pageColor;

                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        SetCustomOption(dialog.Color);
                    }
                }
            }
        }