Set control location to original

Is there any way to set control location to original (initialize time)?
I changing location on many controls, and in some situation I must change they location to original.

-------------Problems Reply------------

just remember the original values and reset them - so before setting your new ones to something like

oldX = control.X

if you have really a lot of controls you can to something like this

private Dictionary<Control, int> OldValuesX = new Dictionary<Control, int>();

public void SaveProperties()
foreach (var ctr in this.Controls)
OldValuesX[ctr] = ctr.X;

and later

public void ResetProperties(Control ctr)
ctr.X = OldValuesX[ctr];

just extent this to your need (for example save more properties than X-Values in a Tuple, self-defined struct, etc.

Category:c# Views:3 Time:2011-08-27

Related post

Copyright (C), All Rights Reserved.

processed in 0.066 (s). 11 q(s)