Major bug: Thumbnails can get resized randomly when placed on displays with different DPI
This commit is contained in:
@@ -9,6 +9,10 @@ namespace EveOPreview.View
|
||||
{
|
||||
public partial class ThumbnailView : Form, IThumbnailView
|
||||
{
|
||||
#region Private constants
|
||||
private const int ResizeEventTimeout = 500;
|
||||
#endregion
|
||||
|
||||
#region Private fields
|
||||
private readonly IWindowManager _windowManager;
|
||||
private readonly ThumbnailOverlay _overlay;
|
||||
@@ -34,6 +38,8 @@ namespace EveOPreview.View
|
||||
|
||||
public ThumbnailView(IWindowManager windowManager)
|
||||
{
|
||||
this.SuppressResizeEvent();
|
||||
|
||||
this._windowManager = windowManager;
|
||||
|
||||
this.IsActive = false;
|
||||
@@ -48,8 +54,6 @@ namespace EveOPreview.View
|
||||
|
||||
this._isHighlightEnabled = false;
|
||||
|
||||
this._suppressResizeEventsTimestamp = DateTime.UtcNow;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
this._overlay = new ThumbnailOverlay(this, this.MouseDown_Handler);
|
||||
@@ -104,6 +108,8 @@ namespace EveOPreview.View
|
||||
|
||||
public new void Show()
|
||||
{
|
||||
this.SuppressResizeEvent();
|
||||
|
||||
base.Show();
|
||||
|
||||
this._isLocationChanged = true;
|
||||
@@ -118,6 +124,8 @@ namespace EveOPreview.View
|
||||
|
||||
public new void Hide()
|
||||
{
|
||||
this.SuppressResizeEvent();
|
||||
|
||||
this.IsActive = false;
|
||||
|
||||
this._overlay.Hide();
|
||||
@@ -126,6 +134,8 @@ namespace EveOPreview.View
|
||||
|
||||
public new void Close()
|
||||
{
|
||||
this.SuppressResizeEvent();
|
||||
|
||||
this.IsActive = false;
|
||||
this._thumbnail?.Unregister();
|
||||
this._overlay.Close();
|
||||
@@ -165,9 +175,8 @@ namespace EveOPreview.View
|
||||
return;
|
||||
}
|
||||
|
||||
// Fix 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(450);
|
||||
this.SuppressResizeEvent();
|
||||
|
||||
this.FormBorderStyle = style;
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
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
|
||||
protected override CreateParams CreateParams
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user