[BUG] Corrected DPI Awareness Mode

Pre-set Per-Monitor DPI Awareness Mode via new Manifest file
This also resolves #137 as window will be drawn at correct location
This commit is contained in:
Peter Kirmeier 2020-10-24 19:50:15 +02:00
parent 47a66d7bce
commit a45d0d8017
4 changed files with 33 additions and 20 deletions

View file

@ -39,5 +39,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.17.2")] [assembly: AssemblyVersion("1.0.17.3")]
[assembly: AssemblyFileVersion("1.0.17.2")] [assembly: AssemblyFileVersion("1.0.17.3")]

12
Resources/app.manifest Normal file
View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="foo"/>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
</assembly>

View file

@ -227,5 +227,6 @@ EXIT 0</PreBuildEvent>
<PackageLicenseFile>LICENSE</PackageLicenseFile> <PackageLicenseFile>LICENSE</PackageLicenseFile>
<RepositoryType></RepositoryType> <RepositoryType></RepositoryType>
<PackageTags>SystemTrayMenu</PackageTags> <PackageTags>SystemTrayMenu</PackageTags>
<ApplicationManifest>Resources\app.manifest</ApplicationManifest>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View file

@ -28,24 +28,24 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TaskbarForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TaskbarForm));
this.SuspendLayout(); this.SuspendLayout();
// //
// TaskbarForm // TaskbarForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.BackColor = System.Drawing.Color.White; this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(120, 0); this.ClientSize = new System.Drawing.Size(120, 0);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false; this.MaximizeBox = false;
this.Name = "TaskbarForm"; this.Name = "TaskbarForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "STM"; this.Text = "STM";
this.LocationChanged += new System.EventHandler(this.TaskbarForm_LocationChanged); this.LocationChanged += new System.EventHandler(this.TaskbarForm_LocationChanged);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion