Question: How can I know in a C#-Application, in which direction the screen of the mobile device is orientated? (i.e. horizontal or vertical).

Answer: 
Add a reference to Microsoft.WindowsCE.Forms to your project. Then you can reference the 
Microsoft.WindowsCE.Forms.**SystemSettings.ScreenOrientation** property, which will give you what you need.

Incidentally, you can set this property, so it can be used to set your screen orientation also.
Just guessing but my first attempt would be:

```
var rect = System.Windows.Forms.Screen.PrimaryScreen.Bounds;
// or var rect = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea;

var ratio = rect.Width / rect.Height;

if (ratio == 1.0) // square screen.
if (ratio > 1.0) // landscape.
if (ratio < 1.0) // portrait.

```