컴퓨터공학/컴퓨터
[C#] 윈도우의 위치와 크기 저장하기
무에서
2016. 8. 10. 20:58
반응형
1. 먼저 아래와 같이 Location과 Size를 추가한다. 값에는 초기값을 넣는다.
2. Form load와 closing에 다음과 같은 코드를 넣는다.
// Form load
private void Form1_Load(object sender, EventArgs e)
{
this.Size = Properties.Settings.Default.Size;
this.Location = Properties.Settings.Default.Location;
}
// Form closing
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
Properties.Settings.Default.Size = this.Size;
Properties.Settings.Default.Location = this.Location;
Properties.Settings.Default.Save();
}
반응형