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

Commit 8666180

Browse files
committed
Fix a couple of high-DPI problems.
1 parent 68c1cd6 commit 8666180

7 files changed

Lines changed: 19 additions & 3 deletions

File tree

src/AddIns/DisplayBindings/HexEditor/Project/Src/Editor.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,10 @@ public Editor()
115115
selection = new SelectionManager(ref buffer);
116116
undoStack = new UndoManager();
117117
insertmode = true;
118-
underscorewidth = MeasureStringWidth(this.CreateGraphics(), "_", Settings.DataFont);
118+
using (var g = this.CreateGraphics()) {
119+
VScrollBar.Width = (int)(VScrollBar.Width * (g.DpiX / 96f));
120+
underscorewidth = MeasureStringWidth(g, "_", Settings.DataFont);
121+
}
119122
underscorewidth3 = underscorewidth * 3;
120123
fontheight = GetFontHeight(Settings.DataFont);
121124
selregion = new Rectangle[] {};

src/Main/Base/Project/Resources/CommonAboutDialog.xfrm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
<StartPosition value = "CenterScreen"/>
1212
<AcceptButton value = "okButton"/>
1313
<CancelButton value = "okButton"/>
14+
<AutoScaleMode value = "Dpi"/>
15+
<AutoScaleDimensions value = "{Width=96, Height=96}"/>
1416

1517
<Controls>
1618

src/Main/Base/Project/Resources/NewFileDialog.xfrm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<MinimizeBox value="False" />
55
<MinimumSize value="350, 190" />
66
<MaximizeBox value="False" />
7+
<AutoScaleMode value="Dpi" />
8+
<AutoScaleDimensions value="{Width=96, Height=96}" />
79
<ShowInTaskbar value="False" />
810
<Text value="${res:Dialog.NewFile.DialogName}" />
911
<ClientSize value="{Width=510, Height=366}" />

src/Main/Base/Project/Resources/NewFileWithNameDialog.xfrm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<MinimumSize value="350, 200" />
55
<MinimizeBox value="False" />
66
<MaximizeBox value="False" />
7+
<AutoScaleMode value="Dpi" />
8+
<AutoScaleDimensions value="{Width=96, Height=96}" />
79
<ShowInTaskbar value="False" />
810
<Text value="${res:Dialog.NewFile.DialogName}" />
911
<ClientSize value="{Width=542, Height=372}" />

src/Main/ICSharpCode.Core.WinForms/MessageService/CustomDialog.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ void MyInitializeComponent()
155155
this.KeyPreview = true;
156156
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
157157
this.Text = "CustomDialog";
158+
this.AutoScaleMode = AutoScaleMode.Dpi;
159+
this.AutoScaleDimensions = new SizeF(96, 96);
158160
}
159161
}
160162
}

src/Main/SharpDevelop/Logging/ExceptionBox.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,11 +333,14 @@ void InitializeComponent()
333333
this.pictureBox.Location = new System.Drawing.Point(0, 0);
334334
this.pictureBox.Name = "pictureBox";
335335
this.pictureBox.Size = new System.Drawing.Size(224, 464);
336+
this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
336337
this.pictureBox.TabIndex = 0;
337338
this.pictureBox.TabStop = false;
338339
//
339340
// ExceptionBox
340341
//
342+
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
343+
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
341344
this.ClientSize = new System.Drawing.Size(688, 453);
342345
this.Controls.Add(this.closeButton);
343346
this.Controls.Add(this.label3);

src/Main/SharpDevelop/Startup/SplashScreen.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,10 @@ public static void SetCommandLineArgs(string[] args)
104104
}
105105

106106
string param = arg.Substring(markerLength);
107-
// work around .NET "feature" that causes trouble with /addindir:"c:\temp\"
108-
// http://www.mobzystems.com/code/bugingetcommandlineargs.aspx
107+
// The SharpDevelop AddIn project template uses /addindir:"c:\temp\"
108+
// but that actually means the last quote is escaped.
109+
// This HACK makes this work anyways by replacing the trailing quote
110+
// with a backslash:
109111
if (param.EndsWith("\"", StringComparison.Ordinal))
110112
param = param.Substring(0, param.Length - 1) + "\\";
111113
parameterList.Add(param);

0 commit comments

Comments
 (0)