private void SetPanelBorderState(SplitterPanel splitterPanel, bool paintBorder) { if (paintBorder) { // save a copy of the current padding if (splitterPanel == split.Panel1) { p1 = splitterPanel.Padding; } else { p2 = splitterPanel.Padding; } // adjust the padding to accommodate the border var p = splitterPanel.Padding; splitterPanel.Padding = new Padding(Math.Max(p.Left, 1), Math.Min(p.Top, 1), Math.Min(p.Right, 1), Math.Min(p.Bottom, 1)); // hook the paint event handler splitterPanel.Paint += splitPanel_Paint; } else { // restore the original padding and then unhook the paint event handler splitterPanel.Padding = (split.Panel1 == splitterPanel ? p1 : p2); splitterPanel.Paint -= splitPanel_Paint; } splitterPanel.Invalidate(); }
private void SetPanelBorderState(SplitterPanel splitterPanel, bool paintBorder) { if (paintBorder) { // save a copy of the current padding if (splitterPanel == split.Panel1) p1 = splitterPanel.Padding; else p2 = splitterPanel.Padding; // adjust the padding to accommodate the border var p = splitterPanel.Padding; splitterPanel.Padding = new Padding(Math.Max(p.Left, 1), Math.Min(p.Top, 1), Math.Min(p.Right, 1), Math.Min(p.Bottom, 1)); // hook the paint event handler splitterPanel.Paint += splitPanel_Paint; } else { // restore the original padding and then unhook the paint event handler splitterPanel.Padding = (split.Panel1 == splitterPanel ? p1 : p2); splitterPanel.Paint -= splitPanel_Paint; } splitterPanel.Invalidate(); }