Created
February 20, 2021 12:20
-
-
Save emoacht/edf6b21fdc9ae4084679d4b7d37e5929 to your computer and use it in GitHub Desktop.
Get taskbar placement from MONITORINFOEX.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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