Major bug: Thumbnails can get resized randomly when placed on displays with different DPI
This commit is contained in:
@@ -61,7 +61,7 @@
|
|||||||
// ThumbnailOverlay
|
// ThumbnailOverlay
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||||
this.BackColor = System.Drawing.Color.Black;
|
this.BackColor = System.Drawing.Color.Black;
|
||||||
this.ClientSize = new System.Drawing.Size(284, 262);
|
this.ClientSize = new System.Drawing.Size(284, 262);
|
||||||
this.ControlBox = false;
|
this.ControlBox = false;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace EveOPreview.View
|
|||||||
//
|
//
|
||||||
this.AccessibleRole = System.Windows.Forms.AccessibleRole.None;
|
this.AccessibleRole = System.Windows.Forms.AccessibleRole.None;
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||||
this.BackColor = System.Drawing.Color.Black;
|
this.BackColor = System.Drawing.Color.Black;
|
||||||
this.ClientSize = new System.Drawing.Size(153, 89);
|
this.ClientSize = new System.Drawing.Size(153, 89);
|
||||||
this.ControlBox = false;
|
this.ControlBox = false;
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ namespace EveOPreview.View
|
|||||||
{
|
{
|
||||||
public partial class ThumbnailView : Form, IThumbnailView
|
public partial class ThumbnailView : Form, IThumbnailView
|
||||||
{
|
{
|
||||||
|
#region Private constants
|
||||||
|
private const int ResizeEventTimeout = 500;
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Private fields
|
#region Private fields
|
||||||
private readonly IWindowManager _windowManager;
|
private readonly IWindowManager _windowManager;
|
||||||
private readonly ThumbnailOverlay _overlay;
|
private readonly ThumbnailOverlay _overlay;
|
||||||
@@ -34,6 +38,8 @@ namespace EveOPreview.View
|
|||||||
|
|
||||||
public ThumbnailView(IWindowManager windowManager)
|
public ThumbnailView(IWindowManager windowManager)
|
||||||
{
|
{
|
||||||
|
this.SuppressResizeEvent();
|
||||||
|
|
||||||
this._windowManager = windowManager;
|
this._windowManager = windowManager;
|
||||||
|
|
||||||
this.IsActive = false;
|
this.IsActive = false;
|
||||||
@@ -48,8 +54,6 @@ namespace EveOPreview.View
|
|||||||
|
|
||||||
this._isHighlightEnabled = false;
|
this._isHighlightEnabled = false;
|
||||||
|
|
||||||
this._suppressResizeEventsTimestamp = DateTime.UtcNow;
|
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
this._overlay = new ThumbnailOverlay(this, this.MouseDown_Handler);
|
this._overlay = new ThumbnailOverlay(this, this.MouseDown_Handler);
|
||||||
@@ -104,6 +108,8 @@ namespace EveOPreview.View
|
|||||||
|
|
||||||
public new void Show()
|
public new void Show()
|
||||||
{
|
{
|
||||||
|
this.SuppressResizeEvent();
|
||||||
|
|
||||||
base.Show();
|
base.Show();
|
||||||
|
|
||||||
this._isLocationChanged = true;
|
this._isLocationChanged = true;
|
||||||
@@ -118,6 +124,8 @@ namespace EveOPreview.View
|
|||||||
|
|
||||||
public new void Hide()
|
public new void Hide()
|
||||||
{
|
{
|
||||||
|
this.SuppressResizeEvent();
|
||||||
|
|
||||||
this.IsActive = false;
|
this.IsActive = false;
|
||||||
|
|
||||||
this._overlay.Hide();
|
this._overlay.Hide();
|
||||||
@@ -126,6 +134,8 @@ namespace EveOPreview.View
|
|||||||
|
|
||||||
public new void Close()
|
public new void Close()
|
||||||
{
|
{
|
||||||
|
this.SuppressResizeEvent();
|
||||||
|
|
||||||
this.IsActive = false;
|
this.IsActive = false;
|
||||||
this._thumbnail?.Unregister();
|
this._thumbnail?.Unregister();
|
||||||
this._overlay.Close();
|
this._overlay.Close();
|
||||||
@@ -165,9 +175,8 @@ namespace EveOPreview.View
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix for WinForms issue with the Resize event being fired with inconsistent ClientSize value
|
this.SuppressResizeEvent();
|
||||||
// Any Resize events fired before this timestamp will be ignored
|
|
||||||
this._suppressResizeEventsTimestamp = DateTime.UtcNow.AddMilliseconds(450);
|
|
||||||
this.FormBorderStyle = style;
|
this.FormBorderStyle = style;
|
||||||
|
|
||||||
// Notify about possible contents position change
|
// Notify about possible contents position change
|
||||||
@@ -384,6 +393,13 @@ namespace EveOPreview.View
|
|||||||
this._thumbnail.Move(0 + highlightWidthLeft, 0 + this._highlightWidth, baseWidth - highlightWidthRight, baseHeight - this._highlightWidth);
|
this._thumbnail.Move(0 + highlightWidthLeft, 0 + this._highlightWidth, baseWidth - highlightWidthRight, baseHeight - this._highlightWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SuppressResizeEvent()
|
||||||
|
{
|
||||||
|
// Workaround for WinForms issue with the Resize event being fired with inconsistent ClientSize value
|
||||||
|
// Any Resize events fired before this timestamp will be ignored
|
||||||
|
this._suppressResizeEventsTimestamp = DateTime.UtcNow.AddMilliseconds(ThumbnailView.ResizeEventTimeout);
|
||||||
|
}
|
||||||
|
|
||||||
#region GUI events
|
#region GUI events
|
||||||
protected override CreateParams CreateParams
|
protected override CreateParams CreateParams
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -75,6 +75,7 @@
|
|||||||
<asmv3:application>
|
<asmv3:application>
|
||||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||||
<dpiAware>True/PM</dpiAware>
|
<dpiAware>True/PM</dpiAware>
|
||||||
|
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
|
||||||
</asmv3:windowsSettings>
|
</asmv3:windowsSettings>
|
||||||
</asmv3:application>
|
</asmv3:application>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user