.NET 4.5 scales toolstrips for us

This commit is contained in:
SupSuper 2018-04-19 03:05:50 +01:00
parent c60467ee3b
commit 52a15de904
2 changed files with 0 additions and 26 deletions

View file

@ -100,19 +100,6 @@ internal void CreateToolbar()
tsMain.SuspendLayout();
// https://www.medo64.com/2014/01/scaling-toolstrip-with-dpi/
using (Graphics g = menuForm.CreateGraphics())
{
double scale = Math.Max(g.DpiX, g.DpiY) / 96.0;
double newScale = ((int)Math.Floor(scale * 100) / 25 * 25) / 100.0;
if (newScale > 1)
{
int newWidth = (int)(tsMain.ImageScalingSize.Width * newScale);
int newHeight = (int)(tsMain.ImageScalingSize.Height * newScale);
tsMain.ImageScalingSize = new Size(newWidth, newHeight);
}
}
menuForm.Controls.Add(tsMain);
if (Form.IsFullscreen)

View file

@ -101,19 +101,6 @@ private void InitializeComponent()
ShowItemToolTips = false
};
// https://www.medo64.com/2014/01/scaling-toolstrip-with-dpi/
using (Graphics g = CreateGraphics())
{
double scale = Math.Max(g.DpiX, g.DpiY) / 96.0;
double newScale = ((int)Math.Floor(scale * 100) / 25 * 25) / 100.0;
if (newScale > 1)
{
int newWidth = (int)(tsMain.ImageScalingSize.Width * newScale);
int newHeight = (int)(tsMain.ImageScalingSize.Height * newScale);
tsMain.ImageScalingSize = new Size(newWidth, newHeight);
}
}
tsMain.MouseLeave += tsMain_MouseLeave;
Controls.Add(tsMain);