I have a small program in winforms that holds 3 buttons. Thus far the program lets the user change a the color of another button by clicking the corresponding button While the third button does not do anything yet. What I want to do is to let the user save changes made to the form (save the form state). So when the form is reopened it opens in that same state as saved.
I hope I am being clear about what I am after
Here is a visualization of the form:

The code that i have so far if any help:
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
btnToColor.Text = "";
}
int c = 0;
private void btnColorSwap_Click(object sender, EventArgs e)
{
if (c == 0)
{
btnToColor.BackColor = Color.Yellow;
c++;
}
else if (c == 1)
{
btnToColor.BackColor = Color.YellowGreen;
c++;
}
else if (c == 2)
{
btnToColor.BackColor = Color.LimeGreen;
c = 0;
}
}
}
This may/may not be easier for you.
Start by creating a class to hold your state:
Now, declare a member for your
Formwith this object:On form load, check if the config exists, then load it:
When your form is closing.. save the config:
Then you can add members to your state class and they will be written into the config.xml file.