mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-08-29 21:37:38 +00:00
Improved the moving and resizing of the gadget on multi-monitor systems. Fixed one problem where the underlying gadget window size would be reduced unrequested. Fine tuned the progress bar size in the gadget.
This commit is contained in:
parent
5f6e6221b4
commit
e5d7595b00
@ -152,7 +152,8 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
if (!lockPositionAndSize) {
|
if (!lockPositionAndSize) {
|
||||||
// prevent the window from leaving the screen
|
// prevent the window from leaving the screen
|
||||||
if ((wp.flags & SWP_NOMOVE) == 0) {
|
if ((wp.flags & SWP_NOMOVE) == 0) {
|
||||||
Rectangle rect = Screen.GetWorkingArea(new Point(wp.x, wp.y));
|
Rectangle rect = Screen.GetWorkingArea(
|
||||||
|
new Rectangle(wp.x, wp.y, wp.cx, wp.cy));
|
||||||
const int margin = 16;
|
const int margin = 16;
|
||||||
wp.x = Math.Max(wp.x, rect.Left - wp.cx + margin);
|
wp.x = Math.Max(wp.x, rect.Left - wp.cx + margin);
|
||||||
wp.x = Math.Min(wp.x, rect.Right - margin);
|
wp.x = Math.Min(wp.x, rect.Right - margin);
|
||||||
@ -195,6 +196,10 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
|
|
||||||
// do not forward any move or size messages
|
// do not forward any move or size messages
|
||||||
wp.flags |= SWP_NOSIZE | SWP_NOMOVE;
|
wp.flags |= SWP_NOSIZE | SWP_NOMOVE;
|
||||||
|
|
||||||
|
// suppress any frame changed events
|
||||||
|
wp.flags &= ~SWP_FRAMECHANGED;
|
||||||
|
|
||||||
Marshal.StructureToPtr(wp, message.LParam, false);
|
Marshal.StructureToPtr(wp, message.LParam, false);
|
||||||
message.Result = IntPtr.Zero;
|
message.Result = IntPtr.Zero;
|
||||||
} break;
|
} break;
|
||||||
@ -383,6 +388,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
public const uint SWP_NOSIZE = 0x0001;
|
public const uint SWP_NOSIZE = 0x0001;
|
||||||
public const uint SWP_NOMOVE = 0x0002;
|
public const uint SWP_NOMOVE = 0x0002;
|
||||||
public const uint SWP_NOACTIVATE = 0x0010;
|
public const uint SWP_NOACTIVATE = 0x0010;
|
||||||
|
public const uint SWP_FRAMECHANGED = 0x0020;
|
||||||
public const uint SWP_HIDEWINDOW = 0x0080;
|
public const uint SWP_HIDEWINDOW = 0x0080;
|
||||||
public const uint SWP_SHOWWINDOW = 0x0040;
|
public const uint SWP_SHOWWINDOW = 0x0040;
|
||||||
public const uint SWP_NOZORDER = 0x0004;
|
public const uint SWP_NOZORDER = 0x0004;
|
||||||
|
@ -379,8 +379,8 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
new Rectangle(back.Width - r, back.Height - b, r, b), u);
|
new Rectangle(back.Width - r, back.Height - b, r, b), u);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawProgress(Graphics g, int x, int y, int width, int height,
|
private void DrawProgress(Graphics g, float x, float y,
|
||||||
float progress)
|
float width, float height, float progress)
|
||||||
{
|
{
|
||||||
g.DrawImage(barBack,
|
g.DrawImage(barBack,
|
||||||
new RectangleF(x + width * progress, y, width * (1 - progress), height),
|
new RectangleF(x + width * progress, y, width * (1 - progress), height),
|
||||||
@ -474,7 +474,8 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
rightMargin;
|
rightMargin;
|
||||||
} else {
|
} else {
|
||||||
DrawProgress(g, w - progressWidth - rightMargin,
|
DrawProgress(g, w - progressWidth - rightMargin,
|
||||||
y + 4, progressWidth, 6, 0.01f * sensor.Value.Value);
|
y + 0.35f * sensorLineHeight, progressWidth,
|
||||||
|
0.6f * sensorLineHeight, 0.01f * sensor.Value.Value);
|
||||||
|
|
||||||
remainingWidth = w - progressWidth - rightMargin;
|
remainingWidth = w - progressWidth - rightMargin;
|
||||||
}
|
}
|
||||||
|
@ -37,5 +37,5 @@
|
|||||||
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("0.2.1.6")]
|
[assembly: AssemblyVersion("0.2.1.7")]
|
||||||
[assembly: AssemblyInformationalVersion("0.2.1.6 Alpha")]
|
[assembly: AssemblyInformationalVersion("0.2.1.7 Alpha")]
|
Loading…
x
Reference in New Issue
Block a user