|
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.Windows.Forms;
namespace
Controls
{
public
class
MyTableLayoutPanel
:
TableLayoutPanel
{
///
<summary>
///
Remove all Controls
on given row
///
</summary>
///
<param name="row"></param>
public
void
RemoveAllControlsOnRow(int
row)
{
for
(int
curcol = 0; curcol <
this.ColumnCount;
curcol++)
{
Control
c =
this.GetControlFromPosition(curcol,
row);
while
(c !=
null)
{
this.Controls.Remove(c);
c =
this.GetControlFromPosition(curcol,
row);
}
}
}
///
<summary>
///
Move all controls to
another row
///
</summary>
///
<param name="sourcerow"></param>
///
<param name="destrow"></param>
public
void
MoveAllControlsOnRow(int
sourcerow,
int
destrow)
{
for
(int
curcol = 0; curcol <
this.ColumnCount;
curcol++)
{
Control
c =
this.GetControlFromPosition(curcol,
sourcerow);
while
(c !=
null)
{
this.SetRow(c,
destrow);
c =
this.GetControlFromPosition(curcol,
sourcerow);
}
}
}
///
<summary>
///
Remove row from
table
///
</summary>
///
<param
name="index"></param>
public
void
RemoveRowAt(int
row)
{
RemoveAllControlsOnRow(row);
for
(int
currow = row+1;
currow <
this.RowCount;
currow++)
{
MoveAllControlsOnRow(currow,
currow - 1);
}
this.RowCount--;
}
}
}
|