Changing existing scheme palette colors


Author
Message
Craig Swearingen
Craig Swearingen
Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)Supreme Being (97 reputation)
Group: Forum Members
Posts: 99, Visits: 654
I have code similar to the following to allow the end user to set the palette they would like to use. You'll notice if the Longhorn scheme is selected I instead turn it into a custom scheme and just change the Window value in it. I change this value because the Longhorn.Window value makes it hard to see a mouse pointer and keyboard cursor over entry field controls.

private void miPalette_Click(object sender, CommandEventArgs e)
{
if (NUIManager.Palette.ShowEditor() == DialogResult.OK)
{
if (NUIManager.Palette.Scheme == ColorScheme.Longhorn)
{
NUIManager.Palette.Scheme = ColorScheme.Custom;
NUIManager.Palette.Window = Color.FromArgb(60, 58, 53);
}
}
}

Is there a way I can directly change the Longhorn scheme color values instead? Is this the best way to address this issue? Given I'm exposing the palette editor to the end user I'd like a little control over the contents of it.
Reply
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hello Craig,

You can set desired custom palette and serialize it into a file. Than you can load it and apply it on the whole application or on particular control(s).

Here is a small code snipped which demonstrates how to save and load custom palette:

//save
NPalette p = new NPalette();
p.Scheme = ColorScheme.Longhorn;
p.Window = Color.FromArgb(60, 58, 53);

p.SaveToFile(filePath);

//load
NPalette p = NPalette.FromFile(filePath, typeof(NPalette));

I hope this helps.

Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search