Listing 1

private void Form1_Resize(object sender, EventArgs e)
{
  // Height > Width = Portrait layout
  if (this.Bounds.Height > this.Bounds.Width)
  {
    listBoxContacts.Height = 182;
  }
  else
  {
    listBoxContacts.Height = 100;
  }

  labelContacts.Top = listBoxContacts.Top –
    labelContacts.Height - 2 ;
}


Listing 2

static class EntryPoint
{
  static void Main()
  {
    Form f;
    if (Screen.PrimaryScreen.Bounds.Height >
        Screen.PrimaryScreen.Bounds.Width)
      f = new FormPortrait();
    else
      f = new FormLandscape();

    Application.Run(f);
  }
}