Wednesday, February 9, 2011

Detecting Graphic Options in .NET

What is the the best of detecting and later altering the screen resolution and multiple desktop within .net

I have a small app that while runs at work on my multiple monitor/high(ish) resolution however what I want to be able to detect is the users primary monitor and set the application to that (main objective) and adjust the resolution to ensure the application fits(more for my own curiosity)

  • I would never suggest altering a user's resolution unless you're doing something like a full-screen game, you can use

     System.Windows.Forms.Screen.PrimaryScreen
    

    to give you metrics about that main monitor.

    From Bob King
  • If you're working on a WinForms-based application, in addition to using the Screen metrics described by Bob King, you can also go with layout controls, such as TableLayout and FlowLayout. Layout controls allow you to design your UI to adapt to the screen/window size cleanly. (The WinForms app I'm currently working on does this very well, down to a minimum of 1024x768, up to whatever your heart desires, scaling controls all the way.)

    Preemptive comment: Yes, TableLayouts do involve a performance hit. However, my experience has been that users tend to be OK with it when shown the benefits. (New monitor: The app still looks great and works!)

    Bob King : As an aside, layouts in WPF are much more seamless and let you design apps that handle resolution changes much more easily.
    From John Rudy

0 comments:

Post a Comment