Skip to content

Instantly share code, notes, and snippets.

@SajjadArifGul
Created October 8, 2015 17:13
Show Gist options
  • Save SajjadArifGul/ebeddb5cc0ca8b30414e to your computer and use it in GitHub Desktop.
Save SajjadArifGul/ebeddb5cc0ca8b30414e to your computer and use it in GitHub Desktop.
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
//initializing width, height,
int width, height;
//setting values to form's current width & height.
width = this.Width;
height = this.Height;
//accessing & modifying registery at SOFTWARE
//if registry exists it will modify it, if doesn't exist
//then it will be created thats why w are using 'true' statement.
RegistryKey software = Registry.LocalMachine.OpenSubKey("SOFTWARE", true);
//creating & modifying subregistery at RegDotNet of SOFTWARE
RegistryKey RegEx = software.CreateSubKey("RegDotNet");
//creating & modifying subregistery at Size of RegDotNet
RegistryKey SizeKey = RegEx.CreateSubKey("Size");
//storing values of width & height into Registry.
SizeKey.SetValue("width",width.ToString());
SizeKey.SetValue("height", height.ToString());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment