dotnet / dotnet/dotnet-api-docs
Error with Screen.FromControls(this).WorkingArea;
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
#5480
private void ScreenshotAutoPlusUI_Load(object sender, EventArgs e)
{
Rectangle screenRect = Screen.FromControl(this).WorkingArea;
this.DesktopBounds = screenRect;
int heightSidePanelNeedsToBe = screenRect.Height - HeightOfAreAboveViewport;
screenshotAutoTop_Panel.Height = HeightOfAreAboveViewport;
screenshotAutoSide_Panel.Height = heightSidePanelNeedsToBe;
this.TopMost = true;
backgroundWorker1.WorkerSupportsCancellation = true;
processUpdates_RTB.Text = "Process status: Opened.";
}
When I use the code above, the screenshotAutoSide_Panel ends up overlapping the search bar in the taskbar by a few pixels. But my taskbar isn't set to AutoHide. It shouldn't overlap at all; otherwise, what would be the point of having both the Bounds and WorkingArea properties? Indeed, when I used the debugger to see what screenRect was assigned to, the size was the same as the resolution of the monitor the panel appeared on.
Contributor guide
Assessment
This issue has not been assessed yet.