148: Flickering of live thumbnails
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using EveOPreview.Services;
|
||||
|
||||
namespace EveOPreview.View
|
||||
@@ -7,17 +8,15 @@ namespace EveOPreview.View
|
||||
{
|
||||
#region Private fields
|
||||
private IDwmThumbnail _thumbnail;
|
||||
private Point _startLocation;
|
||||
private Point _endLocation;
|
||||
#endregion
|
||||
|
||||
public LiveThumbnailView(IWindowManager windowManager)
|
||||
: base(windowManager)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
this._thumbnail?.Unregister();
|
||||
base.Close();
|
||||
this._startLocation = new Point(0, 0);
|
||||
this._endLocation = new Point(this.ClientSize);
|
||||
}
|
||||
|
||||
protected override void RefreshThumbnail(bool forceRefresh)
|
||||
@@ -35,13 +34,26 @@ namespace EveOPreview.View
|
||||
|
||||
protected override void ResizeThumbnail(int baseWidth, int baseHeight, int highlightWidthTop, int highlightWidthRight, int highlightWidthBottom, int highlightWidthLeft)
|
||||
{
|
||||
this._thumbnail.Move(0 + highlightWidthLeft, 0 + highlightWidthTop, baseWidth - highlightWidthRight, baseHeight - highlightWidthBottom);
|
||||
var left = 0 + highlightWidthLeft;
|
||||
var top = 0 + highlightWidthTop;
|
||||
var right = baseWidth - highlightWidthRight;
|
||||
var bottom = baseHeight - highlightWidthBottom;
|
||||
|
||||
if ((this._startLocation.X == left) && (this._startLocation.Y == top) && (this._endLocation.X == right) && (this._endLocation.Y == bottom))
|
||||
{
|
||||
return; // No update required
|
||||
}
|
||||
this._startLocation = new Point(left, top);
|
||||
this._endLocation = new Point(right, bottom);
|
||||
|
||||
this._thumbnail.Move(left, top, right, bottom);
|
||||
this._thumbnail.Update();
|
||||
}
|
||||
|
||||
private void RegisterThumbnail()
|
||||
{
|
||||
this._thumbnail = this.WindowManager.GetLiveThumbnail(this.Handle, this.Id);
|
||||
this._thumbnail.Move(this._startLocation.X, this._startLocation.Y, this._endLocation.X, this._endLocation.Y);
|
||||
this._thumbnail.Update();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user