User Interface for .NET / User's Guide / Palettes / Persistency

Persistency
 Overview
A NPalette object provides an easy and intuitive way to persist its state to and from XML via its Save, SaveToFile and FromFile methods. You can also copy one palette from another using the Copy method.
 Persisting State

The following code demonstrates how to persist a NPalette state to a file:

C#
Copy Code
this.nButton1.Palette.SaveToFile(@"C:\myPalette.xml");

//copy this palette to another button
this.nButton2.Palette.Copy(NPalette.FromFile(@"C:\myPalette.xml");
Visual Basic
Copy Code
Me.nButton1.Palette.SaveToFile(@"C:\myPalette.xml")

'copy this palette to another button
Me.nButton2.Palette.Copy(NPalette.FromFile(@"C:\myPalette.xml")
See Also