1、使用ReSize事件
public partial class Form1 : Form
{
private float x;
private float y;
public Form1()
{
InitializeComponent();
x = this.Width;
y = this.Height;
setTag(this);
}
private void setTag(Control cons)
{
foreach(Control con in cons.Controls)
{
con.Tag = con.Width + ";" + con.Height + ";" + con.Left + ";" + con.Top + ";" + con.Font.Size;
if (con.Controls.Count > 0)
{
setTag(con);
}
}
}
private void setControls(float nx,float ny,Control cons)
{
foreach(Control con in cons.Controls)
{
if (con.Tag != null)
{
string[] myTag = con.Tag.ToString().Split(new char[] {
';' });
con.Width =