title: Dot Net Forms in Powershell not displaying in 3D
body: <p>Does anyone have an idea why a .net form would display the default 3D appearance in the Powershell ISE but not when the .ps1 is run? I have changed the flatstyle for the buttons to "standard" with no change. I have .net 4.5 installed. The "popup" flatstyle did change the appearance but that's not what I'm looking for. The calendar and tooltips also look completely different. I tried adding this line but it made no difference:</p>
  
  <pre><code>$MenuBox.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::Fixed3D
  </code></pre>
  
  <p>A screen shot and code sample are below. Thanks.</p>
  
  <p><img src="https://i.stack.imgur.com/Du5bf.png" alt="screen shot"></p>
  
  <pre><code>    # Create a listbox to select the region
      [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
      [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
  
      # Menu Layout
      $MenuBox = New-Object System.Windows.Forms.Form
      $MenuBox.Size = New-Object System.Drawing.Size @(650,450)
      $MenuBox.Text = "Auto v" + $VersionNumber + " - Powershell"
      $MenuBox.StartPosition = "CenterScreen"
      $MenuBox.AutoSize = $False
      $MenuBox.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::Fixed3D
  
      # Menu Header Text
      $MenuHeader = New-Object System.Windows.Forms.Label
      $MenuHeader.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",14,1,3,1)
      $MenuHeader.Location = New-Object System.Drawing.Size(118,20)
      $MenuHeader.Size = New-Object System.Drawing.Size(380,40) 
      $MenuHeader.Text = "$MenuHeaderText"
      $MenuHeader.TextAlign = [System.Drawing.ContentAlignment]::TopCenter
      $MenuBox.Controls.Add($MenuHeader)
  
      # Add Region List Box
      If ($RegionListBoxAvailable -eq "True") {
          $RegionListBoxLabel = New-Object System.Windows.Forms.Label
          $RegionListBoxLabel.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",10,0,3,1)
          $RegionListBoxLabel.Location = New-Object System.Drawing.Size(60,80) 
          $RegionListBoxLabel.Size = New-Object System.Drawing.Size(280,20) 
          $RegionListBoxLabel.Text = "Select the REGION:"
          $MenuBox.Controls.Add($RegionListBoxLabel)
  
          $RegionListBox = New-Object System.Windows.Forms.ListBox 
          $RegionListBox.Location = New-Object System.Drawing.Size(62,100) 
          $RegionListBox.Size = New-Object System.Drawing.Size(130,42) 
          $RegionListBox.Height = 42
          [void] $RegionListBox.Items.Add("Alabama HQ Devices")
          [void] $RegionListBox.Items.Add("Carolinas HQ Devices")
          $RegionListBox.SetSelected(0,$True)
          $global:RegionSelect = $RegionListBox.SelectedItems
          $MenuBox.Controls.Add($RegionListBox)
  
          $RegionListBoxToolTip = New-Object System.Windows.Forms.ToolTip
          $RegionListBoxToolTip.IsBalloon = $True
          $RegionListBoxToolTip.InitialDelay = 1000
          $RegionListBoxToolTip.SetToolTip($RegionListBox, "Select a region based on HQ")
          }
  
      # Add Labels for Menu Elements
      If (!($BoxLabelText -eq $Null)) {
          $BoxLabel = New-Object System.Windows.Forms.Label
          $BoxLabel.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",10,0,3,1)
          $BoxLabel.Location = New-Object System.Drawing.Size(10,60) 
          $BoxLabel.Size = New-Object System.Drawing.Size(680,20) 
          $BoxLabel.Text = "$BoxLabelText"
          $MenuBox.Controls.Add($BoxLabel)
          }
  
      # Button 7
      If (!($ButtonList[6] -eq "Nothing")) {
          $Button7 = New-Object System.Windows.Forms.Button
          $Button7.Location = New-Object System.Drawing.Size(62,60)
          $Button7.Size = New-Object System.Drawing.Size(500,30)
          $Button7.Add_Click({
              $global:ButtonResult = $ButtonList[6]
              $MenuBox.Close()
              })
          $Button7.Text = $ButtonList[6]
          $Button7.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",12,0,3,1)
          $MenuBox.Controls.Add($Button7)
          }
  
      # Button 6
      If (!($ButtonList[5] -eq "Nothing")) {
          $Button6 = New-Object System.Windows.Forms.Button
          $Button6.Location = New-Object System.Drawing.Size(62,100)
          $Button6.Size = New-Object System.Drawing.Size(500,30)
          $Button6.Add_Click({
              $global:ButtonResult = $ButtonList[5]
              $MenuBox.Close()
              })
          $Button6.Text = $ButtonList[5]
          $Button6.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",12,0,3,1)
          $MenuBox.Controls.Add($Button6)
          }
  
      # Button 5
      If (!($ButtonList[4] -eq "Nothing")) {
          $Button5 = New-Object System.Windows.Forms.Button
          $Button5.Location = New-Object System.Drawing.Size(62,140)
          $Button5.Size = New-Object System.Drawing.Size(500,30)
          $Button5.Add_Click({
              $global:ButtonResult = $ButtonList[4]
              $MenuBox.Close()
              })
          $Button5.Text = $ButtonList[4]
          $Button5.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",12,0,3,1)
          $MenuBox.Controls.Add($Button5)
          }
  
      # Button 4
      If (!($ButtonList[3] -eq "Nothing")) {
          $Button4 = New-Object System.Windows.Forms.Button
          $Button4.Location = New-Object System.Drawing.Size(62,180)
          $Button4.Size = New-Object System.Drawing.Size(500,30)
          $Button4.Add_Click({
              $global:ButtonResult = $ButtonList[3]
              $MenuBox.Close()
              })
          $Button4.Text = $ButtonList[3]
          $Button4.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",12,0,3,1)
          $MenuBox.Controls.Add($Button4)
          }
  
      # Button 3
      If (!($ButtonList[2] -eq "Nothing")) {
          $Button3 = New-Object System.Windows.Forms.Button
          $Button3.Location = New-Object System.Drawing.Size(62,220)
          $Button3.Size = New-Object System.Drawing.Size(500,30)
          $Button3.Add_Click({
              $global:ButtonResult = $ButtonList[2]
              $MenuBox.Close()
              })
          $Button3.Text = $ButtonList[2]
          $Button3.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",12,0,3,1)
          $MenuBox.Controls.Add($Button3)
          }
  
      # Button 2
      If (!($ButtonList[1] -eq "Nothing")) {
          $Button2 = New-Object System.Windows.Forms.Button
          $Button2.Location = New-Object System.Drawing.Size(62,260)
          $Button2.Size = New-Object System.Drawing.Size(500,30)
          $Button2.Add_Click({
              $global:ButtonResult = $ButtonList[1]
              $MenuBox.Close()
              })
          $Button2.Text = $ButtonList[1]
          $Button2.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",12,0,3,1)
          $MenuBox.Controls.Add($Button2)
          }
  
      # Button 1 - Includes $Search Variable
      If (!($ButtonList[0] -eq "Nothing")) {
          $Button1 = New-Object System.Windows.Forms.Button
          $Button1.Location = New-Object System.Drawing.Size(62,300)
          $Button1.Size = New-Object System.Drawing.Size(500,30)
          $Button1.Add_Click({
              $global:ButtonResult = $ButtonList[0]
              $MenuBox.Close()
              })
          $Button1.Text = $ButtonList[0]
          #$Button1.Text.MouseOverColor = [System.Drawing.Color]::White
          #$Button1.TextAlign = [System.Drawing.ContentAlignment]::TopCenter
          $Button1.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",12,0,3,1)
          $MenuBox.Controls.Add($Button1)
          }
  
      # Calendar
      If ($CalendarAvailable -eq $True) {
          $Calendar = New-Object System.Windows.Forms.MonthCalendar 
          $Calendar.Location = New-Object System.Drawing.Size(12,80)
          $Calendar.ShowTodayCircle = $False
          $Calendar.MaxDate = Get-Date
          $Calendar.MinDate = $OldestLog
          $Calendar.MaxSelectionCount = "$CalendarDateRange"
          $MenuBox.Controls.Add($Calendar) 
          }
  
      # Exit Button
      $ExitButton = New-Object System.Windows.Forms.Button
      $ExitButton.Location = New-Object System.Drawing.Size(540,370)
      $ExitButton.Size = New-Object System.Drawing.Size(75,23)
      $ExitButton.Text = "Exit"
      $ExitButton.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",11,0,3,1)
      $ExitButton.Add_Click({
          Remove-Item "$WorkingDirectory\Temp\*.*" -Force
          $MenuBox.Close()
          })
      $MenuBox.Controls.Add($ExitButton)
  
      # Show Menu
      $MenuBox.Topmost = $True
      $MenuBox.Add_Shown({$MenuBox.Activate()})
      [void] $MenuBox.ShowDialog()
  </code></pre>