'C# 창의 크기와 위치 기억'에 해당되는 글 1건

728x90

C# 에서 자식창을 띄울때 창의 마지막 크기와 위치를 저장하고 싶을 때


먼저, 솔루션 탐색기에서 Properties 를 선택하고 Settings.settings 를 더블 클릭한다.



아래 그림처럼 이름과 형식을 설정해준다.



이제 이벤트를 생성하여 코드를 추가한다.


private void WBrowser_FormClosing(object sender, FormClosingEventArgs e)
{
    Properties.Settings.Default.FormSize = this.Size;
    Properties.Settings.Default.Location = this.Location;
    Properties.Settings.Default.Save();
}


private void WBrowser_Load(object sender, EventArgs e)
{
    this.Size = Properties.Settings.Default.FormSize;
    this.Location = Properties.Settings.Default.Location;
}



창의 최소 사이즈는 속성에서 설정해준다.




블로그 이미지

Link2Me

,