Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 68c1cd6

Browse files
committed
Fix #356: Search and Replace dialog window does not scale with DPI setting
1 parent 96f6ad6 commit 68c1cd6

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

src/AddIns/Misc/SearchAndReplace/Project/Gui/SearchAndReplaceDialog.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public static void ShowSingleInstance(SearchAndReplaceMode searchAndReplaceMode)
6464

6565
public SearchAndReplaceDialog(SearchAndReplaceMode searchAndReplaceMode)
6666
{
67+
SuspendLayout();
6768
this.FormBorderStyle = FormBorderStyle.FixedToolWindow;
6869
this.ShowInTaskbar = false;
6970
this.TopMost = false;
@@ -94,6 +95,10 @@ public SearchAndReplaceDialog(SearchAndReplaceMode searchAndReplaceMode)
9495
Controls.Add(toolStrip);
9596
RightToLeftConverter.ConvertRecursive(this);
9697

98+
this.AutoScaleMode = AutoScaleMode.Dpi;
99+
this.AutoScaleDimensions = new SizeF(96, 96);
100+
ResumeLayout();
101+
97102
SetSearchAndReplaceMode();
98103
FormLocationHelper.Apply(this, "ICSharpCode.SharpDevelop.Gui.SearchAndReplaceDialog.Location", false);
99104

@@ -144,12 +149,16 @@ void EnableSearchMode(bool enable)
144149

145150
void SetSearchAndReplaceMode()
146151
{
152+
SuspendLayout();
147153
searchAndReplacePanel.SearchAndReplaceMode = searchButton.Checked ? SearchAndReplaceMode.Search : SearchAndReplaceMode.Replace;
154+
this.AutoScaleMode = AutoScaleMode.Dpi;
155+
this.AutoScaleDimensions = new SizeF(96, 96);
148156
if (searchButton.Checked) {
149157
this.ClientSize = new Size(430, 335);
150158
} else {
151159
this.ClientSize = new Size(430, 385);
152160
}
161+
ResumeLayout();
153162
}
154163

155164
/// <summary>

src/Main/SharpDevelop/app.template.config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@
8585
<!-- Use this setting to disable the code completion cache. Code completion will still be
8686
available, but take longer to load and use more RAM. -->
8787
<!-- <add key="domPersistencePath" value="none" /> -->
88+
89+
<!-- Tell WinForms to resize some components based on system DPI.
90+
Only has an effect with .NET 4.5.2 or higher. -->
91+
<add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
8892
</appSettings>
8993
<log4net>
9094
<!-- Writes to the console. The console is only visible in debug builds of SharpDevelop. -->

0 commit comments

Comments
 (0)