dotnet / dotnet/dotnet-api-docs

Error with Screen.FromControls(this).WorkingArea;

Open
#10,022 5 comments 0 reactions 0 assignees View on GitHub
area-WPF Pri3 untriaged
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.