2012-10-10 2 views

답변

1

내가하는 방법은 전역 변수에 컨트롤의 높이를 저장 한 다음 컨트롤을 추가 할 때마다 컨트롤의 높이를 많이 추가하는 것입니다. 이렇게하면 아래에 컨트롤이 표시되도록 매번 위치를 아래로 이동하는 데 필요한 양이 제공됩니다.

다음 버튼을 클릭 이벤트에서 새 컨트롤을 만들고 새 drawing.point 및 컨트롤의 현재 X 위치를 X 매개 변수를 설정하고 전역 변수를 Y 매개 변수를 사용하여 위치를 설정할 것입니다.

int glHeightAccumalator = Control.Height; ' I would set this on the form load when you already have your first control in the Flow Layout Panel. 

''Button Click Event 

Control ctrl = new Control(); 
ctrl.Location = Drawing.Point(ctrl.Location.X, glHeightAccumalator); 
FlowLayoutPanel.Controls.Add(ctrl); 
glHeightAccumalator += ctrl.Height;