Main.Show() Parameter is not valid

0

NOTE: I'm using Bunifu but this error also occurred whenever I changed the font to Century Gothic or any font that's not default.

Here is my code:

Form form = new Main();
form.ShowDialog(new Main());
this.Hide();

The problem:

Anytime any graphical update happens on the Main form it causes the error "Parameter is not valid."

Things I've tried:

this.ShowDialog(new Main());
Application.Run(new Main());
this.Show(new Main());
form.Show();
form.ShowDialog();

Full Error:

System.ArgumentException
  HResult=0x80070057
  Message=Parameter is not valid.
  Source=System.Drawing
  StackTrace:
   at System.Drawing.Drawing2D.GraphicsPath.AddArc(Int32 x, Int32 y, Int32 width, Int32 height, Single startAngle, Single sweepAngle)
   at Bunifu.Framework.UI.BunifuThinButton2.method_0(Graphics graphics_0, Rectangle rectangle_0, Int32 int_4, Pen pen_0, Color color_6)
   at Bunifu.Framework.UI.BunifuThinButton2.Refresh()
   at Bunifu.Framework.UI.BunifuThinButton2.BunifuThinButton2_MouseEnter(Object sender, EventArgs e)
   at Bunifu.Framework.UI.BunifuThinButton2.label1_MouseEnter(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnMouseEnter(EventArgs e)
   at System.Windows.Forms.Label.OnMouseEnter(EventArgs e)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Label.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, Int32 wParam, Int32 lParam)
   at System.Windows.Forms.Control.SendMessage(Int32 msg, Int32 wparam, Int32 lparam)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.RunDialog(Form form)
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at Larray_s_Proxy_Tool__v1._0_.Form1.Form1_Load(Object sender, EventArgs e) in C:\Users\Jardi\Documents\Visual Studio 2017\Projects\Larray's Proxy Tool (v1.0)\Larray's Proxy Tool (v1.0)\Form1.cs:line 63
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
bunifu
asked on Stack Overflow Aug 16, 2018 by Sam Bird • edited Aug 16, 2018 by Hans Passant

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0