public static void SetDefaultState(FormPhoto frm) { foreach (KeyValuePair <string, DefaultSizeAndLocation> pair in FormControls) { frm.Controls[pair.Key].Size = pair.Value.CtrlSize; frm.Controls[pair.Key].Location = pair.Value.CtrlLocation; } }
private static Dictionary <string, DefaultSizeAndLocation> GetDefaultControlParams() { var dict = new Dictionary <string, DefaultSizeAndLocation>(); using (var frm = new FormPhoto()) { foreach (Control control in frm.Controls) { dict.Add(control.Name, new DefaultSizeAndLocation { CtrlSize = control.Size, CtrlLocation = control.Location }); } } return(dict); }