Standard-Toolkit icon indicating copy to clipboard operation
Standard-Toolkit copied to clipboard

[Feature Request]: KryptonColorButton Modify Recent Colors

Open sdreb3421 opened this issue 4 years ago • 9 comments

Currently there is no way to modify the recent colors of a KryptonColorButton. Recommend adding the ability to modify recent colors at runtime and also potentially in the designer.

sdreb3421 avatar Sep 23 '21 17:09 sdreb3421

Hi @sdreb3421

Had a look, I think you need to use SetCustomColors(Color[][] colors)

PWagner1 avatar Sep 23 '21 17:09 PWagner1

I have modified the example to show how to do this:

        private int[] customColors;
        private void ButtonShowFontDialog_Click(object sender, EventArgs e)
        {
            var kfd = new KryptonColorDialog {
                AllowFullOpen = chkAllowFullOpen.Checked,
                ShowHelp = chkShowHelp.Checked,
                AnyColor = chkAnyColor.Checked,
                FullOpen = chkFullOPen.Checked,
                SolidColorOnly = chkSolidColorOnly.Checked,
                CustomColors = customColors
            };
            if (kfd.ShowDialog(this) == DialogResult.OK)
            {
                KryptonMessageBox.Show(this, kfd.Color.ToString(), @"Color chosen is");
                customColors = kfd.CustomColors;
            }
        }

Smurf-IV avatar Sep 23 '21 17:09 Smurf-IV

oops, My mistake thought it was do with the Common control.

Smurf-IV avatar Sep 23 '21 17:09 Smurf-IV

From inside the KryptonColorButton code, there is nothing that is passing the colors onto the KCD (As I showed above)

private void OnClickMoreColors(object sender, EventArgs e)
        {
            // Give user a chance to cancel showing the Krypton more colors dialog
            CancelEventArgs cea = new();
            OnMoreColors(cea);

            // If not instructed to cancel then...
            if (!cea.Cancel)
            {
                // Use a Krypton color dialog for the selection of custom colors
                KryptonColorDialog cd = new()
                {
                    Color = SelectedColor,
                    FullOpen = _allowFullOpen
                };

                // Only if user selected a value do we want to use it
                if (cd.ShowDialog() == DialogResult.OK)
                {
                    SelectedColor = cd.Color;
                }
            }
        }

Smurf-IV avatar Sep 23 '21 17:09 Smurf-IV

Could the KCD have an optional feature to add colours to the KryptonColorButton recent list?

PWagner1 avatar Sep 23 '21 17:09 PWagner1

SetCustomColors

Does this set the following: image

Smurf-IV avatar Sep 23 '21 17:09 Smurf-IV

Could the KCD have an optional feature to add colours to the KryptonColorButton recent list?

I think the KCD should take the colours from the recent colours list.

Smurf-IV avatar Sep 23 '21 17:09 Smurf-IV

Current behavior:

  • It's not possible to add colors programmatically to the recent colors list (recommend implementing).
  • Recent colors are not shown in the KCD custom color list (recommend implementing).
  • The selected color in the KCD is added to the recent colors list (good).
  • Colors selected in the Theme/Standard list are not added to recent colors (recommend implementing).

sdreb3421 avatar Sep 23 '21 20:09 sdreb3421

Similar to #776

jgreywolf avatar Jul 08 '22 18:07 jgreywolf

@sdreb3421 I know this is "old" but I'm a little confused (See below):

Current behavior: * It's not possible to add colors programmatically to the recent colors list (recommend implementing).

Ok, this is what this FR is about

* Recent colors are not shown in the KCD custom color list (recommend implementing).

Do you mean __KCD__ialog, or just miss-typed and you mean __KCB__utton?

* Colors selected in the Theme/Standard list are not added to recent colors (recommend implementing).

Do you mean __KCB__utton?

Smurf-IV avatar Dec 04 '22 08:12 Smurf-IV

This is done: image

Smurf-IV avatar Dec 04 '22 09:12 Smurf-IV

@sdreb3421

Please re-test using build >= .338

PWagner1 avatar Dec 04 '22 15:12 PWagner1

Hi @sdreb3421

Is this working now?

PWagner1 avatar Aug 27 '23 14:08 PWagner1

Yes thank you

sdreb3421 avatar Aug 28 '23 16:08 sdreb3421