From 214cd572d92f0c04fc414ef8b11895ba0502d42a Mon Sep 17 00:00:00 2001 From: Alexander Illarionov Date: Mon, 24 Jun 2024 15:22:29 +0300 Subject: [PATCH] Issues #24 Made width and height attributes as optional for windowSizeItems section (supplement) --- SmartContextMenu/Forms/MainForm.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/SmartContextMenu/Forms/MainForm.cs b/SmartContextMenu/Forms/MainForm.cs index cc2b44f..87a05a2 100644 --- a/SmartContextMenu/Forms/MainForm.cs +++ b/SmartContextMenu/Forms/MainForm.cs @@ -695,11 +695,17 @@ private void MenuItemClick(Window window, WindowSizeMenuItem menuItem) else if (_settings.Sizer == WindowSizerType.WindowWithoutMargins) { var margins = window.GetSystemMargins(); - window.SetSize(menuItem.Width + margins.Left + margins.Right, menuItem.Height + margins.Top + margins.Bottom, menuItem.Left, menuItem.Top); + window.SetSize(menuItem.Width == null ? null : (menuItem.Width + margins.Left + margins.Right), + menuItem.Height == null ? null : (menuItem.Height + margins.Top + margins.Bottom), + menuItem.Left, + menuItem.Top); } else { - window.SetSize(menuItem.Width + (window.Size.Width - window.ClientSize.Width), menuItem.Height + (window.Size.Height - window.ClientSize.Height), menuItem.Left, menuItem.Top); + window.SetSize(menuItem.Width == null ? null : (menuItem.Width + (window.Size.Width - window.ClientSize.Width)), + menuItem.Height == null ? null : (menuItem.Height + (window.Size.Height - window.ClientSize.Height)), + menuItem.Left, + menuItem.Top); } }