Skip to content

Instantly share code, notes, and snippets.

@emoacht
Created February 20, 2021 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emoacht/edf6b21fdc9ae4084679d4b7d37e5929 to your computer and use it in GitHub Desktop.
Save emoacht/edf6b21fdc9ae4084679d4b7d37e5929 to your computer and use it in GitHub Desktop.
Get taskbar placement from MONITORINFOEX.
public enum TaskbarPlacement { Unknown, Left, Top, Right, Bottom }
private TaskbarPlacement GetPlacement(MONITORINFOEX monitorInfo)
{
var m = monitorInfo.rcMonitor;
var w = monitorInfo.rcWork;
return (left: (m.left == w.left),
top: (m.top == w.top),
right: (m.right == w.right),
bottom: (m.bottom == w.bottom)) switch
{
(left: false, true, true, true) => TaskbarPlacement.Left,
(true, top: false, true, true) => TaskbarPlacement.Top,
(true, true, right: false, true) => TaskbarPlacement.Right,
(true, true, true, bottom: false) => TaskbarPlacement.Bottom,
_ => default
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment