How to get supported display modes using SharpDX

Below is a short bit of code that will use SharpDX to enumerate the valid display modes on all adapters (video cards) and all outputs (monitors) for the computer that is hosting the application.

There are a few caveats with this:

  • Do not run this if you are using the Windows RT device simulator from Visual Studio 2012 or you will get exceptions (remote/virtualized instances aren’t supported by some of the DirectX used here)
  • This only shows interlaced and scaling display modes (there are Stereo and StereoDisabled modes for some outputs)
  • Keep in mind that this is every adapter and output on your computer, so if you want just the default adapter, you’ll have to make some changes
  • Windows Store Apps are always in full screen, so any display mode that you apply to the active device where the resolution is less than the desktop resolution is going to look stretched (there are reasons to do this, however)

References:

Leave a Reply

Your email address will not be published. Required fields are marked *