I am making a desktop app that has an transparent background (think desktop toy), and I am trying to work out if there is a way to get the following values for the Windows Task Bar; position, orientation, hidden, locked, etc.
I want to align some game assets so the Task Bar was like the "floor"
Can anyone point me in the correct direction?
Regards, Ian
Regardless of the solution you find, it'll most likely break all compatibility with other OS's.
If that's not a problem, the simplest solution would probably be to use System.Windows.Forms.Screen
's WorkingArea
property. This returns the width+height of the screen, minus the taskbar (and some other things, like docked windows).
This isn't normally included within your project (since it's OS specific), so we'll have to install the DLL which contains this code manually:
C:\Windows\Microsoft.NET\Framework\v(highest version number)\System.Windows.Forms.dll
into that new Plugins folder After all this, you should be able to import System.Windows.Forms
like normal, and call Screen.WorkingArea
for the safe area to move around within. Do note that Unity has it's own "Screen" class, so you might need to explicitly call our new Screen instead via System.Windows.Forms.Screen.WorkingArea
.
Do note that this also returns a System.Drawing.Rectangle
, instead of Unity's UnityEngine.Rect
, so just take the width and height instead of storing the resulting rect.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.