Question

I'm currently developing for a handheld device running Windows XP Professional (not Tablet PC edition). The device allows users to switch from the standard widescreen landscape display format to a portrait one. I would like to know if there are any VB.NET code snippets to help me along with this task.

Was it helpful?

Solution

The way to determine the current orientation is with the System.Windows.Forms.SystemInformation.ScreenOrientation property.

To get the actual size of the screen, check System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height (and .Width)

You can declare an event handler (with the AddHandler statement) for Microsoft.Win32.SystemEvents.DisplaySettingsChanged as a trigger your app can respond to, and then check the screen orientation to see if you need to adjust your GUI layout.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top