From 04e96106733fe92ed5e44f66daf3bf0eb06565f6 Mon Sep 17 00:00:00 2001 From: Nick Vella Date: Thu, 16 May 2019 18:54:34 +1000 Subject: [PATCH] dpi: fix SideBarControl button scaling --- .../OpenLiveWriter.ApplicationFramework/SideBarControl.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/managed/OpenLiveWriter.ApplicationFramework/SideBarControl.cs b/src/managed/OpenLiveWriter.ApplicationFramework/SideBarControl.cs index f4db7e8e..23dd2fa5 100644 --- a/src/managed/OpenLiveWriter.ApplicationFramework/SideBarControl.cs +++ b/src/managed/OpenLiveWriter.ApplicationFramework/SideBarControl.cs @@ -170,7 +170,7 @@ namespace OpenLiveWriter.ApplicationFramework BitmapButton bitmapButton = new BitmapButton(); bitmapButton.Tag = index; bitmapButton.Click += new EventHandler(bitmapButton_Click); - bitmapButton.AutoSizeHeight = true; + bitmapButton.AutoSizeHeight = false; bitmapButton.AutoSizeWidth = false; bitmapButton.ButtonStyle = ButtonStyle.Flat; bitmapButton.TextAlignment = TextAlignment.Right; @@ -178,7 +178,7 @@ namespace OpenLiveWriter.ApplicationFramework bitmapButton.BitmapEnabled = bitmap; bitmapButton.BitmapSelected = bitmap; bitmapButton.ClickSetsFocus = true; - bitmapButton.Size = new Size(Control.Width - (PAD * 2), 0); + bitmapButton.Size = new Size(Control.Width - (PAD * 2), 52); bitmapButton.TabStop = false; bitmapButton.AccessibleName = text; bitmapButton.Name = name; @@ -216,18 +216,22 @@ namespace OpenLiveWriter.ApplicationFramework foreach (BitmapButton button in bitmapButtonList) { button.AutoSizeWidth = true; + button.AutoSizeHeight = true; // HACK: AutoSizeWidth doesn't quite work right; it doesn't // take effect until SetBoundsCore gets called, so I have // to "change" the width to force the SetBoundsCore call. // Yuck!! button.Width = button.Width + 1; + button.Height = button.Height + 1; maxWidth = Math.Max(maxWidth, button.Width); } foreach (BitmapButton button in bitmapButtonList) { button.AutoSizeWidth = false; + button.AutoSizeHeight = false; button.Width = maxWidth; + button.Height = (int)Math.Ceiling(button.Height / (DisplayHelper.PixelsPerLogicalInchY / 96f)); } Width = maxWidth + PAD * 2;