Update IntegratedProgram and PowerShell protocols to respect connection frame padding

Co-authored-by: Kvarkas <3611964+Kvarkas@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-10-18 23:20:09 +00:00
parent 55fec45b58
commit 12920bc6c6
2 changed files with 14 additions and 8 deletions

View File

@@ -139,10 +139,13 @@ namespace mRemoteNG.Connection.Protocol
try
{
if (InterfaceControl.Size == Size.Empty) return;
NativeMethods.MoveWindow(_handle, -SystemInformation.FrameBorderSize.Width,
-(SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height),
InterfaceControl.Width + SystemInformation.FrameBorderSize.Width * 2,
InterfaceControl.Height + SystemInformation.CaptionHeight +
// Use ClientRectangle to account for padding (for connection frame color)
Rectangle clientRect = InterfaceControl.ClientRectangle;
NativeMethods.MoveWindow(_handle,
clientRect.X - SystemInformation.FrameBorderSize.Width,
clientRect.Y - (SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height),
clientRect.Width + SystemInformation.FrameBorderSize.Width * 2,
clientRect.Height + SystemInformation.CaptionHeight +
SystemInformation.FrameBorderSize.Height * 2, true);
}
catch (Exception ex)

View File

@@ -229,10 +229,13 @@ namespace mRemoteNG.Connection.Protocol.PowerShell
try
{
if (InterfaceControl.Size == Size.Empty) return;
NativeMethods.MoveWindow(_handle, -SystemInformation.FrameBorderSize.Width,
-(SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height),
InterfaceControl.Width + SystemInformation.FrameBorderSize.Width * 2,
InterfaceControl.Height + SystemInformation.CaptionHeight +
// Use ClientRectangle to account for padding (for connection frame color)
Rectangle clientRect = InterfaceControl.ClientRectangle;
NativeMethods.MoveWindow(_handle,
clientRect.X - SystemInformation.FrameBorderSize.Width,
clientRect.Y - (SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height),
clientRect.Width + SystemInformation.FrameBorderSize.Width * 2,
clientRect.Height + SystemInformation.CaptionHeight +
SystemInformation.FrameBorderSize.Height * 2, true);
}
catch (Exception ex)