mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-02 18:26:27 +13:00
ToolStrip high DPI support
This commit is contained in:
parent
c5a1426853
commit
4e66c387b2
1 changed files with 13 additions and 0 deletions
|
@ -77,6 +77,19 @@ private void CreateMenu()
|
|||
|
||||
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);
|
||||
|
||||
ToolStripLabel tslDragLeft = new ToolStripLabel()
|
||||
|
|
Loading…
Reference in a new issue