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
This commit is contained in:
Camilo Alvarez
2019-01-29 23:19:33 -05:00
parent 41f1a65ce6
commit b3cfcc1a5e
2 changed files with 8 additions and 7 deletions

View File

@@ -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;
}
}

View File

@@ -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