Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7636941

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:48:53+00:00 2026-05-31T07:48:53+00:00

An application with docking capabilities can save the desktop with the positions of all

  • 0

An application with docking capabilities can save the desktop with the positions of all windows including the ones on separate monitors.

If the saved desktop is reloaded but one or more of the monitors is not connected, the application should detect this.
I have the following:

    ...
    Windows windows = Window.GetWindow(pane);
    if (window != null)
    {
      PaneTookWindow = toolWindow = window.Content as PaneToolWindow;
      if (toolWindow != null)
      {
        if (!AreaInScreenBounds(new Rect(toolWindow.Left, toolWindow.Top, toolWindow.Width, toolWindow.Height)))
        {
           pane.ExecuteCommand(ContentPaneCommands.ChangeToDocument);
        }
      }
    }
    ...


   private static bool AreaInScreenBounds(Rect area)
   {
      if (Application.Current != null && Application.Current.MainWindow != null)
      {
         Rect [] screeAreas = Application.Current.MainWindow.GetScreenAreas();
         return screenAreas.Any(screen => screen.Contains(area));
      }
      return false;
   }

The problem is that this method does not detect whether the monitor is no longer available, but whether the area is outside of the MainWindow area.

Does anyone know, how to detect a disconnected monitor or a no longer available area?

  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:48:55+00:00Added an answer on May 31, 2026 at 7:48 am

    Screen Class represents a display device or multiple display devices on a single system. You should want the ‘Bounds’ attribute for the resolutions and the ‘AllScreens’ attribute for the number of displays connected

    int index;
    int upperBound; 
    Screen [] screens = Screen.AllScreens;
    upperBound = screens.GetUpperBound(0);
    for(index = 0; index <= upperBound; index++)
    {
    // For each screen, add the screen properties to a list box.
       listBox1.Items.Add("Device Name: " + screens[index].DeviceName);
       listBox1.Items.Add("Bounds: " + screens[index].Bounds.ToString());
       listBox1.Items.Add("Type: " + screens[index].GetType().ToString());
       listBox1.Items.Add("Working Area: " + screens[index].WorkingArea.ToString());
       listBox1.Items.Add("Primary Screen: " + screens[index].Primary.ToString());
    }
    

    More info here: http://msdn.microsoft.com/en-us/library/system.windows.forms.screen.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a user control for Windows forms application. All it has is a
I want to add docking capabilities in an application, haven't had a need for
In my MFC (Feature Pack) application one can dynamically create docking panes to display
Trying to replicate the docking controls in Visual Studio 2008. My application replays the
Application works fine. I can access everything in debug except for an Array Adapter
I have C# application which uses weifenluo.winformsui.docking.dll 2.3.1.0 for Docking. It runs nicely in
I am getting a blue screen when my windows winform application is run. It
Application: This is a workshop proposal system for a conference. A user can create
I am porting a .NET CF 1.0 WinForms application (for older versions of Windows
Application has an auxiliary thread. This thread is not meant to run all the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.