Stored Thumbnail position is not applied to the newly created thumbnail immediately

This commit is contained in:
Anton Kasyanov
2016-06-06 21:25:50 +03:00
parent c47e13622f
commit 2812c17034
2 changed files with 23 additions and 9 deletions

View File

@@ -5,17 +5,21 @@ namespace EveOPreview.UI
{ {
public partial class ThumbnailOverlay : Form public partial class ThumbnailOverlay : Form
{ {
#region Private fields
private readonly Action<object, MouseEventArgs> _areaClickAction; private readonly Action<object, MouseEventArgs> _areaClickAction;
#endregion
public ThumbnailOverlay(Action<object, MouseEventArgs> areaClickAction) public ThumbnailOverlay(Form owner, Action<object, MouseEventArgs> areaClickAction)
{ {
this.Owner = owner;
this._areaClickAction = areaClickAction; this._areaClickAction = areaClickAction;
InitializeComponent(); InitializeComponent();
} }
private void OverlayArea_Click(object sender, MouseEventArgs e) private void OverlayArea_Click(object sender, MouseEventArgs e)
{ {
this._areaClickAction(sender, e); this._areaClickAction(this, e);
} }
public void SetOverlayLabel(string label) public void SetOverlayLabel(string label)

View File

@@ -40,7 +40,7 @@ namespace EveOPreview.UI
InitializeComponent(); InitializeComponent();
this._overlay = new ThumbnailOverlay(this.ThumbnailActivated_Handler); this._overlay = new ThumbnailOverlay(this, this.ThumbnailActivated_Handler);
} }
public IntPtr Id { get; set; } public IntPtr Id { get; set; }
@@ -64,6 +64,22 @@ namespace EveOPreview.UI
public bool IsOverlayEnabled { get; set; } public bool IsOverlayEnabled { get; set; }
public new Point Location
{
get
{
return base.Location;
}
set
{
if ((value.X > 0) || (value.Y > 0))
{
this.StartPosition=FormStartPosition.Manual;
}
base.Location = value;
}
}
public event Action<IntPtr> ThumbnailResized; public event Action<IntPtr> ThumbnailResized;
public event Action<IntPtr> ThumbnailMoved; public event Action<IntPtr> ThumbnailMoved;
@@ -76,16 +92,11 @@ namespace EveOPreview.UI
public new void Show() public new void Show()
{ {
this.StartPosition = (this.Location.X > 0) || (this.Location.Y > 0)
? FormStartPosition.Manual
: FormStartPosition.WindowsDefaultLocation;
base.Show(); base.Show();
if (this.IsOverlayEnabled) if (this.IsOverlayEnabled)
{ {
this._overlay.Show(); this._overlay.Show();
this._overlay.TopMost = true;
} }
else else
{ {
@@ -138,7 +149,6 @@ namespace EveOPreview.UI
public void SetTopMost(bool enableTopmost) public void SetTopMost(bool enableTopmost)
{ {
this.TopMost = enableTopmost; this.TopMost = enableTopmost;
this._overlay.TopMost = true;
} }
public new void Refresh() public new void Refresh()