public static Size? GetSize(Size? size) { var form = new SelectSizeForm(); if (size != null) { form.controlWidth.Value = size.Value.Width; form.controlHeight.Value = size.Value.Height; } else { form.controlWidth.Value = 40; form.controlHeight.Value = 30; } var res = form.ShowDialog(); if (res != DialogResult.OK) return null; return new Size((int) form.controlWidth.Value, (int) form.controlHeight.Value); }
public static Size?GetSize(Size?size) { var form = new SelectSizeForm(); if (size != null) { form.controlWidth.Value = size.Value.Width; form.controlHeight.Value = size.Value.Height; } else { form.controlWidth.Value = 40; form.controlHeight.Value = 30; } var res = form.ShowDialog(); if (res != DialogResult.OK) { return(null); } return(new Size((int)form.controlWidth.Value, (int)form.controlHeight.Value)); }