Optionally show a border around the thumbnail of the currently active EVE client

This commit is contained in:
Anton Kasyanov
2016-08-17 19:10:11 +03:00
parent ae071a9a1c
commit 88140d257e
12 changed files with 131 additions and 66 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.Drawing;
using System.Windows.Forms;
namespace EveOPreview.UI
@@ -7,6 +8,8 @@ namespace EveOPreview.UI
{
#region Private fields
private readonly Action<object, MouseEventArgs> _areaClickAction;
private bool _highlightEnabled;
private Color _highlightColor;
#endregion
public ThumbnailOverlay(Form owner, Action<object, MouseEventArgs> areaClickAction)
@@ -14,6 +17,9 @@ namespace EveOPreview.UI
this.Owner = owner;
this._areaClickAction = areaClickAction;
this._highlightEnabled = false;
this._highlightColor = Color.Red;
InitializeComponent();
}
@@ -27,6 +33,24 @@ namespace EveOPreview.UI
this.OverlayLabel.Text = label;
}
public void EnableOverlayLabel(bool enable)
{
this.OverlayLabel.Visible = enable;
}
public void EnableHighlight(bool enabled, Color color)
{
if (!enabled && !this._highlightEnabled)
{
// Nothing to do here
return;
}
this._highlightEnabled = enabled;
this._highlightColor = color;
this.Refresh();
}
protected override CreateParams CreateParams
{
get
@@ -36,5 +60,19 @@ namespace EveOPreview.UI
return Params;
}
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (this._highlightEnabled)
{
ControlPaint.DrawBorder(e.Graphics, this.ClientRectangle,
this._highlightColor, 4, ButtonBorderStyle.Solid,
this._highlightColor, 4, ButtonBorderStyle.Solid,
this._highlightColor, 4, ButtonBorderStyle.Solid,
this._highlightColor, 4, ButtonBorderStyle.Solid);
}
}
}
}