From 76992babb73cd5431a010b127af513e5e6922751 Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 28 Oct 2024 17:14:59 -0400 Subject: [PATCH] resize headings on navigator window resize (#1643) #1640 --- .../Commands/Navigator/NavigatorWindow.Designer.cs | 1 + OneMore/Commands/Navigator/NavigatorWindow.cs | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/OneMore/Commands/Navigator/NavigatorWindow.Designer.cs b/OneMore/Commands/Navigator/NavigatorWindow.Designer.cs index 1f5e483ad5..e371906d14 100644 --- a/OneMore/Commands/Navigator/NavigatorWindow.Designer.cs +++ b/OneMore/Commands/Navigator/NavigatorWindow.Designer.cs @@ -141,6 +141,7 @@ private void InitializeComponent() this.pageBox.Name = "pageBox"; this.pageBox.Size = new System.Drawing.Size(528, 250); this.pageBox.TabIndex = 0; + this.pageBox.Resize += new System.EventHandler(this.ResizePageBox); // // pageHeadPanel // diff --git a/OneMore/Commands/Navigator/NavigatorWindow.cs b/OneMore/Commands/Navigator/NavigatorWindow.cs index b98cc112fc..8e3bcfc2b2 100644 --- a/OneMore/Commands/Navigator/NavigatorWindow.cs +++ b/OneMore/Commands/Navigator/NavigatorWindow.cs @@ -539,6 +539,20 @@ private async void DoKeyDown(object sender, KeyEventArgs e) e.Handled = true; } } + + + private void ResizePageBox(object sender, EventArgs e) + { + var margin = SystemInformation.VerticalScrollBarWidth * 2; + + foreach (MoreLinkLabel link in pageBox.Controls) + { + var leftpad = ((Heading)link.Tag).Level * HeaderIndent; + var leftmar = leftpad + 4; + link.Width = pageBox.Width - leftmar - margin; + + } + } #endregion Page headings