Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Multi monitors

Multi monitors

Scheduled Pinned Locked Moved C#
questiontutorial
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Christian Graus
    wrote on last edited by
    #1

    I know how to find all my monitors using the Windows.Screen object, but how can I specify which window to put a form onto ? Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "But there isn't a whole lot out there that pisses me off more than someone leaving my code looking like they leaned on the keyboard and prayed that it would compile. - Jamie Hale, 17/4/2002

    P 1 Reply Last reply
    0
    • C Christian Graus

      I know how to find all my monitors using the Windows.Screen object, but how can I specify which window to put a form onto ? Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "But there isn't a whole lot out there that pisses me off more than someone leaving my code looking like they leaned on the keyboard and prayed that it would compile. - Jamie Hale, 17/4/2002

      P Offline
      P Offline
      Paul M Watt
      wrote on last edited by
      #2

      I believe if you use the Windows.Screen.Bounds value to determine the bounds of the screen this will tell you where that particular screen resides with respect to the entire virtual desktop. Then set the StartPosition property of your form to the bounds position for the screen. You can also use the Location property to change the position of form at runtime. You can also use the SystemInformation.VirtualScreen Property to determine maximum virtual space for your multiple monitors. This will also tell you if there are negative coordinates for the virtual desktop. Good Luck!


      Build a man a fire, and he will be warm for a day
      Light a man on fire, and he will be warm for the rest of his life!

      C 2 Replies Last reply
      0
      • P Paul M Watt

        I believe if you use the Windows.Screen.Bounds value to determine the bounds of the screen this will tell you where that particular screen resides with respect to the entire virtual desktop. Then set the StartPosition property of your form to the bounds position for the screen. You can also use the Location property to change the position of form at runtime. You can also use the SystemInformation.VirtualScreen Property to determine maximum virtual space for your multiple monitors. This will also tell you if there are negative coordinates for the virtual desktop. Good Luck!


        Build a man a fire, and he will be warm for a day
        Light a man on fire, and he will be warm for the rest of his life!

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        Thanks, but I found and tried all this. My main desktop is on the right, but the virtualScreen does not hafve any negative numbers, nor does drawing beyond my desktop on the one draw to the other. This would probably work *if* I had a dual monitor setup where they were considered a single desktop, but then it would work just by getting the bounds of the current desktop. Have you got two monitors ? I'm keen to know if you've had success with this method. Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "But there isn't a whole lot out there that pisses me off more than someone leaving my code looking like they leaned on the keyboard and prayed that it would compile. - Jamie Hale, 17/4/2002

        P 1 Reply Last reply
        0
        • C Christian Graus

          Thanks, but I found and tried all this. My main desktop is on the right, but the virtualScreen does not hafve any negative numbers, nor does drawing beyond my desktop on the one draw to the other. This would probably work *if* I had a dual monitor setup where they were considered a single desktop, but then it would work just by getting the bounds of the current desktop. Have you got two monitors ? I'm keen to know if you've had success with this method. Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "But there isn't a whole lot out there that pisses me off more than someone leaving my code looking like they leaned on the keyboard and prayed that it would compile. - Jamie Hale, 17/4/2002

          P Offline
          P Offline
          Paul M Watt
          wrote on last edited by
          #4

          The experience that I have had with multi-monitor support has shown me that each screen comprises a sub-rectangle in the entire large screen. The primary monitor will always be located at (0,0), for backward compatibility. I am curious what the bounds value for each screen returns. Are they both located at (0,0), or are they arranged logically on the virtual desktop like the documentation suggests. What does the virtual desktop setting return? Does it still not return a very large rectangle where both of your monitors are found? I don't have Visual Studio .Net at home, so I can't really test this, but I have done it with Visual Basic. From reading the documentation, I believe that Visual Basic and C# perfrom this operation in much the same way. I do not know if this will help you, but there is a VB sample in MSDN called MultiMon.exe. If I come up with something else I will let you know. Good Luck.


          Build a man a fire, and he will be warm for a day
          Light a man on fire, and he will be warm for the rest of his life!

          C 1 Reply Last reply
          0
          • P Paul M Watt

            The experience that I have had with multi-monitor support has shown me that each screen comprises a sub-rectangle in the entire large screen. The primary monitor will always be located at (0,0), for backward compatibility. I am curious what the bounds value for each screen returns. Are they both located at (0,0), or are they arranged logically on the virtual desktop like the documentation suggests. What does the virtual desktop setting return? Does it still not return a very large rectangle where both of your monitors are found? I don't have Visual Studio .Net at home, so I can't really test this, but I have done it with Visual Basic. From reading the documentation, I believe that Visual Basic and C# perfrom this operation in much the same way. I do not know if this will help you, but there is a VB sample in MSDN called MultiMon.exe. If I come up with something else I will let you know. Good Luck.


            Build a man a fire, and he will be warm for a day
            Light a man on fire, and he will be warm for the rest of his life!

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            kilowatt wrote: The experience that I have had with multi-monitor support has shown me that each screen comprises a sub-rectangle in the entire large screen. The primary monitor will always be located at (0,0), for backward compatibility. That can be true, if the computer is set up to treat the monitors as one large desktop. kilowatt wrote: I am curious what the bounds value for each screen returns. Are they both located at (0,0), or are they arranged logically on the virtual desktop like the documentation suggests. No, they return co-ordinates arranged as if they were one desktop. But if I draw onto my primary desktop to negative co-ordinates in the X direction, nothing appears on my secondary monitor, which is on the left. kilowatt wrote: What does the virtual desktop setting return? Does it still not return a very large rectangle where both of your monitors are found? It returns a large rectangle, my problem is that I cannot use any values I get from Screen to actually access the secondary desktop. kilowatt wrote: I don't have Visual Studio .Net at home, so I can't really test this, but I have done it with Visual Basic. From reading the documentation, I believe that Visual Basic and C# perfrom this operation in much the same way. I do not know if this will help you, but there is a VB sample in MSDN called MultiMon.exe. Is it VB.NET ? kilowatt wrote: If I come up with something else I will let you know. Good Luck. Thanks for your help. I expected it to work the way you are suggesting, or expose a method to actually *access* a screen, but it doesn't appear to be the case. Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "But there isn't a whole lot out there that pisses me off more than someone leaving my code looking like they leaned on the keyboard and prayed that it would compile. - Jamie Hale, 17/4/2002

            1 Reply Last reply
            0
            • P Paul M Watt

              I believe if you use the Windows.Screen.Bounds value to determine the bounds of the screen this will tell you where that particular screen resides with respect to the entire virtual desktop. Then set the StartPosition property of your form to the bounds position for the screen. You can also use the Location property to change the position of form at runtime. You can also use the SystemInformation.VirtualScreen Property to determine maximum virtual space for your multiple monitors. This will also tell you if there are negative coordinates for the virtual desktop. Good Luck!


              Build a man a fire, and he will be warm for a day
              Light a man on fire, and he will be warm for the rest of his life!

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              I just came back to let you know I am an idiot :rose: I had my app set to full screen, which overrode my other settings, which is why this did not initially work. While I had found all this stuff before, it was your post that made me go back to play with it again and find my error, so thanks a million. Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "But there isn't a whole lot out there that pisses me off more than someone leaving my code looking like they leaned on the keyboard and prayed that it would compile. - Jamie Hale, 17/4/2002

              P 1 Reply Last reply
              0
              • C Christian Graus

                I just came back to let you know I am an idiot :rose: I had my app set to full screen, which overrode my other settings, which is why this did not initially work. While I had found all this stuff before, it was your post that made me go back to play with it again and find my error, so thanks a million. Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "But there isn't a whole lot out there that pisses me off more than someone leaving my code looking like they leaned on the keyboard and prayed that it would compile. - Jamie Hale, 17/4/2002

                P Offline
                P Offline
                Paul M Watt
                wrote on last edited by
                #7

                Your Welcome! I am glad that you figured it out.


                Build a man a fire, and he will be warm for a day
                Light a man on fire, and he will be warm for the rest of his life!

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups