문제

I have a tablelayoutpanel divided in 4 columns and 4 rows. by using Panel box = new Panel(); I filled in all 4x4 tablelayout panel with panels. now I have to delete in example a Panel which is in 2 collumn and 3 row. how do I do that?

도움이 되었습니까?

해결책

There are a few ways to do it, but try this one;

tableLayoutPanel.Controls.Remove(tableLayoutPanel1.GetControlFromPosition(col, row));

This is assuming you're just trying to remove the panels (As they would be child controls to the tableLayoutPanel).

Otherwise you could remove directly by passing the actual panel you want to remove through the method;

tableLayoutPanel.Controls.Remove(panelYouWantToRemove);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top