"The user needs to choose his notifyIcon icon from his hard drive".
Is the icon in a filename somewhere? If the user selects an icon from the hard driver, does he in fact select a file that contains an icon?
If that is the case, you should define Properties.Settings.Default.UserIcon
as a string and save the name of the filename. Give your window a property that gets and sets the UserIcon.
private string UserIconFileName
{
get => Properties.Settings.Default.UserIcon;
set => properties.Settings.Default.UserIcon = value;
}
private Icon LoadUserIcon
{
string userIconFileName = this.UserIconFileName
if (!File.Exists(userIconFileName))
{
// TODO: decide what to do if there is no such file
}
else
{
return new Icon(userIconFileName);
}
}
Don't forget to Save your properties when closing the program:
private void OnFormClosed(object sender, FormClosedEventArgs e)
{
Properties.Settings.Default.Save();
}