Exemplo n.º 1
0
        private void PrepareRecentColors()
        {
            int length = Math.Min(HelpersOptions.RecentColors.Count, HelpersOptions.RecentColorsMax);

            for (int i = 0; i < length; i++)
            {
                ColorButton colorButton = new ColorButton()
                {
                    Color             = HelpersOptions.RecentColors[i],
                    Size              = new Size(16, 16),
                    Margin            = new Padding(1),
                    BorderColor       = Color.FromArgb(100, 100, 100),
                    Offset            = 0,
                    HoverEffect       = true,
                    ManualButtonClick = true
                };

                colorButton.Click += (sender, e) => SetCurrentColor(colorButton.Color, true);

                flpRecentColors.Controls.Add(colorButton);
                if ((i + 1) % 16 == 0)
                {
                    flpRecentColors.SetFlowBreak(colorButton, true);
                }
            }
        }
Exemplo n.º 2
0
        private void PrepareColorPalette()
        {
            flpColorPalette.Controls.Clear();

            Color[] colors;

            if (rbRecentColors.Checked)
            {
                colors = HelpersOptions.RecentColors.ToArray();
            }
            else
            {
                colors = ColorHelpers.StandardColors;
            }

            int length = Math.Min(colors.Length, HelpersOptions.RecentColorsMax);

            Color previousColor = Color.Empty;

            for (int i = 0; i < length; i++)
            {
                ColorButton colorButton = new ColorButton()
                {
                    Color             = colors[i],
                    Size              = new Size(16, 16),
                    Margin            = new Padding(1),
                    BorderColor       = Color.FromArgb(100, 100, 100),
                    Offset            = 0,
                    HoverEffect       = true,
                    ManualButtonClick = true
                };

                colorButton.MouseClick += (sender, e) =>
                {
                    if (e.Button == MouseButtons.Left)
                    {
                        SetCurrentColor(colorButton.Color, true);

                        if (!IsScreenColorPickerMode)
                        {
                            if (!previousColor.IsEmpty && previousColor == colorButton.Color)
                            {
                                CloseOK();
                            }
                            else
                            {
                                previousColor = colorButton.Color;
                            }
                        }
                    }
                };

                flpColorPalette.Controls.Add(colorButton);
                if ((i + 1) % 16 == 0)
                {
                    flpColorPalette.SetFlowBreak(colorButton, true);
                }
            }
        }
Exemplo n.º 3
0
        private void PrepareRecentColors()
        {
            for (int i = 0; i < 32; i++)
            {
                ColorButton colorButton = new ColorButton()
                {
                    Color             = new HSB(i / 32d, 1d, 1d),
                    Size              = new Size(16, 16),
                    Offset            = 2,
                    Margin            = new Padding(0),
                    ManualButtonClick = true
                };

                colorButton.Click += (sender, e) => SetCurrentColor(colorButton.Color, true);

                flpRecentColors.Controls.Add(colorButton);
                if ((i + 1) % 16 == 0)
                {
                    flpRecentColors.SetFlowBreak(colorButton, true);
                }
            }
        }