728x90

화면 Layout 을 보기 좋게 하기 위해서 SplitContainer 클래스를 이용한다.

유투브 동영상을 보면서 익힌 사용법을 나중에 다시 보려고 기록해둔다.

tabControl Layout 에서 아래 번호 순서대로 하면 된다.



SplitContainer 클래스를 사용하면 기본적으로 수직분할이 된다.

A Split Container is a combination of three components.  Panel1 and Panel2 are separated either horizontally or vertically by a splitter.


수직으로 분할하기 위해서는

먼저 splitContainer2 를 찾아서 선택한다. (최초로 splitContainer 를 사용한 경우에는 splitContainer1 을 선택)

그래야만 Orientation 속성이 보인다. Horizontal 로 변경하면 ....


수직으로 분할된 창이 보일 것이다.

Panel1, Panel2 를 선택하면 7번처럼 창의 위치를 조정할 수가 없다.

마찬가지로 splitContainer2 속성이 선택되어야만 가능하다.


상단에 검색할 버튼을 만들기 위함이고 하단에는 dataGridView 을 추가하기 위한 Layout 이다.




Panel1 과 Panel2 사이를 움직이지 못하게 하는 방법은

split container 속성의 IsSplitterFixed true 로 설정하면 고정된다.




고정하고 싶은 Panel 부분에 2줄을 추가해주면 된다.

this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.IsSplitterFixed = true;

Designer.cs 파일에 기록된 정보를 확인해 보니...

// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.IsSplitterFixed = true;
this.splitContainer1.Location = new System.Drawing.Point(3, 3);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.lbl_View);
this.splitContainer1.Panel1.Controls.Add(this.comboBox2);
this.splitContainer1.Panel1.Controls.Add(this.comboBox1);
this.splitContainer1.Panel1.Controls.Add(this.lbl_totalcnt1);
this.splitContainer1.Panel1.Controls.Add(this.totalcnt1);
this.splitContainer1.Panel1.Controls.Add(this.btnSave);
this.splitContainer1.Panel1.Controls.Add(this.btnSearch);
this.splitContainer1.Panel1.Controls.Add(this.searchBox);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.dataGridView1);
this.splitContainer1.Size = new System.Drawing.Size(1146, 462);
this.splitContainer1.SplitterDistance = 39;
this.splitContainer1.TabIndex = 0;



관련 추가 자료는 참조

http://www.c-sharpcorner.com/uploadfile/6897bc/container-controls-3-splitcontainer/


C# 에 대해 좀더 알아보면 좋은 사이트

http://www.java2s.com/Code/CSharpAPI/CatalogCSharpAPI.htm



블로그 이미지

Link2Me

,