locked
Multi-monitor computer: Which one has the taskbar? RRS feed

  • Question

  • How can I determine whether the monitor my application is running on has the Windows taskbar on it?

    I "think" that it's the Primary monitor that always has the taskbar. Is that correct? If so, how might I determine whether my application is running on the Primary monitor? Or is there a way to detect whether the monitor-it's-running-on has a taskbar?

    My application expands its own window so that it covers the entire monitor. In the case where it's running on the primary monitor (which I'm assuming is the only monitor that can have the Windows taskbar on it, at the bottom) I provide a method whereby the user can click on a special control and the application window shrinks just enough to reveal the Windows taskbar. If there IS NO taskbar on the monitor then I want to disable that "shrink-to-reveal-taskbar" functionality.

    Monday, April 11, 2011 8:18 PM

Answers

  • Is there a way to determine which monitor my application is currently located on?

    Pass your primary form into Screen.FromControl()
    • Marked as answer by Cookie Luo Tuesday, April 19, 2011 11:40 AM
    Tuesday, April 12, 2011 11:17 PM

All replies

  • Yes, that is my understanding of (one of) the aspects of the "primary" monitor.

    Do me a favor, though - when you write your code, please, please, please make it work no matter which edge the taskbar is on.  I am one of those people who puts his taskbar in a wierd place (I usually use the left hand side of the screen - which I switched to from using the top of the screen because the vast majority of apps do not account for this and will start with their title bar underneath my taskbar which made it impossible to move them).

    Evan

    • Proposed as answer by Evan Machusak Monday, April 11, 2011 8:59 PM
    Monday, April 11, 2011 8:58 PM
  • Evan,

    That just raises an additional issue. How can my app determine which side the task bar is on?

    Tuesday, April 12, 2011 1:57 AM
  • In a multi monitor setup, any monitor might have a taskbar, all monitors could have one at the same time.  The might be a taskbar on more than one edge of a display.

    You should compare the working area to the display area on a monitor to check for task bars.

    Tuesday, April 12, 2011 3:31 AM
  • Is there a way to determine which monitor my application is currently located on?
    Tuesday, April 12, 2011 6:47 PM
  • Is there a way to determine which monitor my application is currently located on?

    Pass your primary form into Screen.FromControl()
    • Marked as answer by Cookie Luo Tuesday, April 19, 2011 11:40 AM
    Tuesday, April 12, 2011 11:17 PM