public class MainForm
{
public float wX = Screen.PrimaryScreen.Bounds.Width;
public float hY = Screen.PrimaryScreen.Bounds.Height;
public MainForm()
{
InitializeComponent();
//switch screen
float newx = wX / this.Width;
float newy = hY / this.Height;
setTag(this);
setControls(newx, newy, this);
}
private void setTag(Control cons)
{
foreach (Control con in cons.Controls)
{
con.Tag = con.Width + ":" + con.Height + ":" + con.Left + ":" + con.Top;
if (con.Controls.Count > 0)
{
setTag(con);
}
}
}