From b3cfcc1a5ee9020c2e4e8457cb806b796b46e8bc Mon Sep 17 00:00:00 2001 From: Camilo Alvarez Date: Tue, 29 Jan 2019 23:19:33 -0500 Subject: [PATCH] Screenshot only taken from ConnectionTab area Screenshots contained dockstrip area (the tab name with the x icon), now they are only limited to the ConnectionTab area --- mRemoteV1/Tools/MiscTools.cs | 11 +++++------ mRemoteV1/UI/Window/ConnectionWindow.cs | 4 +++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/mRemoteV1/Tools/MiscTools.cs b/mRemoteV1/Tools/MiscTools.cs index 03722aa2d..fc11aeb63 100644 --- a/mRemoteV1/Tools/MiscTools.cs +++ b/mRemoteV1/Tools/MiscTools.cs @@ -84,16 +84,15 @@ namespace mRemoteNG.Tools } - public static Image TakeScreenshot(ConnectionWindow sender) + public static Image TakeScreenshot(UI.Tabs.ConnectionTab sender) { try - { - var ac = sender.ActiveControl; - if (ac != null) + { + if (sender != null) { - var bmp = new Bitmap(ac.Width, ac.Height, PixelFormat.Format32bppRgb); + var bmp = new Bitmap(sender.Width, sender.Height, PixelFormat.Format32bppRgb); Graphics g = Graphics.FromImage(bmp); - g.CopyFromScreen(ac.PointToScreen(Point.Empty), Point.Empty , bmp.Size, CopyPixelOperation.SourceCopy); + g.CopyFromScreen(sender.PointToScreen(Point.Empty), Point.Empty , bmp.Size, CopyPixelOperation.SourceCopy); return bmp; } } diff --git a/mRemoteV1/UI/Window/ConnectionWindow.cs b/mRemoteV1/UI/Window/ConnectionWindow.cs index 6d8e7b7cb..3141bf265 100644 --- a/mRemoteV1/UI/Window/ConnectionWindow.cs +++ b/mRemoteV1/UI/Window/ConnectionWindow.cs @@ -723,7 +723,9 @@ namespace mRemoteNG.UI.Window { cmenTab.Close(); Application.DoEvents(); - Windows.ScreenshotForm.AddScreenshot(MiscTools.TakeScreenshot(this)); + var selectedTab = (ConnectionTab)GetInterfaceControl()?.Parent; + if (selectedTab == null) return; + Windows.ScreenshotForm.AddScreenshot(MiscTools.TakeScreenshot(selectedTab)); } #endregion