public static SelectionRules FilterSelectionRules(SelectionRules baseRules, Control control, bool autoSize) { if (autoSize) { if (AutoSizePanel.CanAutoSizeWidth(control)) { baseRules &= ~(SelectionRules.LeftSizeable | SelectionRules.RightSizeable); } if (AutoSizePanel.CanAutoSizeHeight(control)) { baseRules &= ~(SelectionRules.TopSizeable | SelectionRules.BottomSizeable); } } return(baseRules); }
public static SelectionRules FilterContainerSelectionRules(SelectionRules baseRules, Control control, bool autoSize) { if (autoSize) { bool flag = false; bool flag2 = true; bool flag3 = true; for (int i = 0; i < control.Controls.Count; i++) { Control control2 = control.Controls[i]; if (control2.Visible) { flag = true; switch (control2.Dock) { case DockStyle.None: flag2 = false; flag3 = false; break; case DockStyle.Top: case DockStyle.Bottom: flag3 = false; break; case DockStyle.Left: case DockStyle.Right: flag2 = false; break; } } } if (flag && !flag2 && AutoSizePanel.CanAutoSizeWidth(control)) { baseRules &= ~(SelectionRules.LeftSizeable | SelectionRules.RightSizeable); } if (flag && !flag3 && AutoSizePanel.CanAutoSizeHeight(control)) { baseRules &= ~(SelectionRules.TopSizeable | SelectionRules.BottomSizeable); } } return(baseRules); }