Fixed Issue 215.
This commit is contained in:
@@ -176,12 +176,16 @@ namespace OpenHardwareMonitor.GUI {
|
||||
set {
|
||||
if (value != window.Visible) {
|
||||
window.Visible = value;
|
||||
if (VisibleChanged != null)
|
||||
VisibleChanged(this, EventArgs.Empty);
|
||||
if (value)
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler VisibleChanged;
|
||||
|
||||
public void Redraw() {
|
||||
if (!window.Visible)
|
||||
return;
|
||||
|
||||
@@ -201,6 +201,20 @@ namespace OpenHardwareMonitor.GUI {
|
||||
Redraw();
|
||||
};
|
||||
|
||||
VisibleChanged += delegate(object sender, EventArgs e) {
|
||||
Rectangle bounds = new Rectangle(Location, Size);
|
||||
Screen screen = Screen.FromRectangle(bounds);
|
||||
Rectangle intersection =
|
||||
Rectangle.Intersect(screen.WorkingArea, bounds);
|
||||
if (intersection.Width < Math.Min(16, bounds.Width) ||
|
||||
intersection.Height < Math.Min(16, bounds.Height))
|
||||
{
|
||||
Location = new Point(
|
||||
screen.WorkingArea.Width / 2 - bounds.Width / 2,
|
||||
screen.WorkingArea.Height / 2 - bounds.Height / 2);
|
||||
}
|
||||
};
|
||||
|
||||
MouseDoubleClick += delegate(object obj, MouseEventArgs args) {
|
||||
SendHideShowCommand();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user