Skip to content

Commit

Permalink
fix sharing a non-primary screen
Browse files Browse the repository at this point in the history
  • Loading branch information
EslaMx7 committed Feb 22, 2022
1 parent df2809c commit eae83af
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ScreenTask/frmMain.cs
Expand Up @@ -263,12 +263,13 @@ private void TakeScreenshot(bool captureMouse)
bmp = null;
return;
}
Rectangle bounds = Screen.GetBounds(Point.Empty);

Rectangle bounds = Screen.AllScreens[comboScreens.SelectedIndex].Bounds;
using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
{
using (Graphics g = Graphics.FromImage(bitmap))
{
g.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size);
g.CopyFromScreen(new Point(bounds.X,bounds.Y), Point.Empty, bounds.Size);
}
rwl.AcquireWriterLock(Timeout.Infinite);
bitmap.Save(Application.StartupPath + "/WebServer" + "/ScreenTask.jpg", ImageFormat.Jpeg);
Expand Down

0 comments on commit eae83af

Please sign in to comment.