From 61a45443c8972a48fa33a673a932d8552d32631b Mon Sep 17 00:00:00 2001 From: tznind Date: Fri, 6 Jan 2023 01:11:38 +0000 Subject: [PATCH] Add menu items for toggling borders in SplitContainerExample --- UICatalog/Scenarios/SplitContainerExample.cs | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/UICatalog/Scenarios/SplitContainerExample.cs b/UICatalog/Scenarios/SplitContainerExample.cs index 828266954..0049a1631 100644 --- a/UICatalog/Scenarios/SplitContainerExample.cs +++ b/UICatalog/Scenarios/SplitContainerExample.cs @@ -19,6 +19,9 @@ namespace UICatalog.Scenarios { private MenuItem miShowPanel2; private MenuItem miShowNeither; + private MenuItem miSplitContainer1Border; + private MenuItem minestedSplitContainerBorder; + /// /// Setup the scenario. /// @@ -84,6 +87,16 @@ namespace UICatalog.Scenarios { Checked = splitContainer.Orientation == Orientation.Vertical, CheckType = MenuItemCheckStyle.Checked }, + miSplitContainer1Border = new MenuItem ("_Outer Panel Border", "", () => ToggleBorder(miSplitContainer1Border, splitContainer)) + { + Checked = splitContainer.Border.BorderStyle == BorderStyle.Single, + CheckType = MenuItemCheckStyle.Checked + }, + minestedSplitContainerBorder = new MenuItem ("_Inner Panel Border", "", () => ToggleBorder(minestedSplitContainerBorder,nestedSplitContainer)) + { + Checked = nestedSplitContainer.Border.BorderStyle == BorderStyle.Single, + CheckType = MenuItemCheckStyle.Checked + }, new MenuBarItem ("_Show", new MenuItem [] { miShowBoth = new MenuItem ("Both", "",()=>{ splitContainer.Panels [0].Visible = true; @@ -141,6 +154,19 @@ namespace UICatalog.Scenarios { nestedSplitContainer.Orientation = miVertical.Checked ? Orientation.Horizontal : Orientation.Vertical; } + private void ToggleBorder (MenuItem menuItem, SplitContainer splitContainer) + { + menuItem.Checked = !menuItem.Checked; + + if(menuItem.Checked) { + splitContainer.Border.BorderStyle = BorderStyle.Single; + splitContainer.Border.DrawMarginFrame = true; + } else { + splitContainer.Border.BorderStyle = BorderStyle.None; + splitContainer.Border.DrawMarginFrame = false; + } + } + private void Quit () { Application.RequestStop ();