title: Form.ShowDialog() causes 'Invalid parameter' error
body: <p>I'm facing a weird issue.</p>
  
  <p>I created a small WinForms project containing a main form and an auxiliary one. I create the second form inside the first one in a code which resembles this one:</p>
  
  <pre><code>private void btnOpenForm_Click(object sender, EventArgs e)
  {
      NewForm form = new NewForm(value1, value2);
      form.ShowDialog();
  }
  </code></pre>
  
  <p>When I use the <code>ShowDialog()</code> method, the program fails immediately after method execution with an <code>Invalid parameter</code> error, while the regular <code>Show()</code> method works fine. Via stacktrace, it says I can't use the same form as owner to the new one, but then how am I supposed to show a modal dialog, calling from the main form?</p>
  
  <p>Main window constructor:</p>
  
  <pre><code>public MainWindow()
  {
      InitializeComponent();
  }
  </code></pre>
  
  <p>Auxiliary form constructor:</p>
  
  <pre><code>public VectorPlot(Point2D OriginalVector, Point2D RotatedVector)
  {
      InitializeComponent();
  
      _originalVector = OriginalVector;
      _rotatedVector = RotatedVector;
  }
  </code></pre>
  
  <p>Main window call to auxiliary window:</p>
  
  <pre><code>VectorPlot Plot = new VectorPlot(OriginalVector, ModifiedVector);
  Plot.ShowDialog();
  </code></pre>
  
  <p>Paint event:</p>
  
  <pre><code>private void VectorPlot_Paint(object sender, PaintEventArgs e)
  {
      using (Graphics g = e.Graphics)
      {
          GraphicsContainer container = g.BeginContainer(new RectangleF(0f, 0f, 300f, 300f), new RectangleF(0f, 0f, 300f, 300f), GraphicsUnit.Pixel);
          g.FillRectangle(new SolidBrush(Color.White), new RectangleF(0f, 0f, 300f, 350f));
          g.DrawLine(new Pen(Color.Gray), 150f, 0f, 150f, 300f);
          g.DrawLine(new Pen(Color.Gray), 0f, 150f, 300f, 150f);
  
          float xOrigVect =  (float)_originalVector.X;
          float yOrigVect = (float)_originalVector.Y;
          float xRotVect = (float)_rotatedVector.X;
          float yRotVect = (float)_rotatedVector.Y;
  
          xOrigVect = 150f + xOrigVect;
          yOrigVect = 150f - yOrigVect;
          xRotVect = 150f + xRotVect;
          yRotVect = 150f - yRotVect;
  
          g.DrawLine(new Pen(Color.Blue, 2f), 150f, 150f, xOrigVect, yOrigVect);
          g.DrawLine(new Pen(Color.Red, 2f), 150f, 150f, xRotVect, yRotVect);
  
          g.DrawString("Legenda: ", new System.Drawing.Font("sans-serif", 8.0f), Brushes.Black, new PointF(0f, 310f));
          g.DrawLine(new Pen(Color.Blue, 2f), 0f, 330f, 10f, 330f);
          g.DrawString("Vetor original", new System.Drawing.Font("sans-serif", 8.0f), Brushes.Black, new PointF(10f, 322f));
          g.DrawLine(new Pen(Color.Red, 2f), 0f, 340f, 10f, 340f);
          g.DrawString("Vetor rotacionado", new System.Drawing.Font("sans-serif", 8.0f), Brushes.Black, new PointF(10f, 332f));
          g.EndContainer(container);
      }
  }
  </code></pre>
  
  <p>Stack trace:</p>
  
  <pre><code>System.ArgumentException was unhandled
  HResult=-2147024809
  Message=Parâmetro inválido.
  Source=System.Drawing
  StackTrace:
     em System.Drawing.Graphics.get_Clip()
     em System.Drawing.Graphics.GetContextInfo()
     em System.Windows.Forms.Internal.WindowsGraphics.FromGraphics(Graphics g, ApplyGraphicsProperties properties)
     em System.Windows.Forms.WindowsGraphicsWrapper..ctor(IDeviceContext idc, TextFormatFlags flags)
     em System.Windows.Forms.VisualStyles.VisualStyleRenderer.DrawBackground(IDeviceContext dc, Rectangle bounds)
     em System.Windows.Forms.Form.OnPaint(PaintEventArgs e)
     em System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
     em System.Windows.Forms.Control.WmPaint(Message&amp; m)
     em System.Windows.Forms.Control.WndProc(Message&amp; m)
     em System.Windows.Forms.ScrollableControl.WndProc(Message&amp; m)
     em System.Windows.Forms.ContainerControl.WndProc(Message&amp; m)
     em System.Windows.Forms.Form.WndProc(Message&amp; m)
     em System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp; m)
     em System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m)
     em System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  InnerException: 
  </code></pre>