These are the Error Message that i'm getting when i pressed customize Minimized button.
System.ArgumentException
HResult=0x80070057
Message=Parameter is not valid.
Source=System.Drawing
StackTrace:
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)
at CircularProgressBar.CircularProgressBar.RecreateBackgroundBrush()
at CircularProgressBar.CircularProgressBar.ParentOnResize(Object sender, EventArgs eventArgs)
at System.Windows.Forms.Control.OnResize(EventArgs e)
at System.Windows.Forms.UserControl.OnResize(EventArgs e)
at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
at System.Windows.Forms.Control.UpdateBounds()
at System.Windows.Forms.Control.WmWindowPosChanged(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.UserControl.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)
When I started using new custom controls, I experienced the same error when attempting to minimize with a custom button. I could not figure it out until I looked at the detailed exception message.
System.ArgumentException
HResult=0x80070057
Message=Parameter is not valid.
Source=System.Drawing
StackTrace:
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)
at Bunifu.UI.WinForms.BunifuGradientPanel.Refresh()
at Bunifu.UI.WinForms.BunifuGradientPanel.OnResize(EventArgs eventargs)
It was the new BunifuGradientPanel, which worked fine before, it was minimizing all day, but I stepped away from VS for a few hours and when I returned it started to error. Strange.
I am not sure but I suspect that the bunifuGradientPanel1 is not disposing itself properly.
To fix it, just do this.
public bool isMinimized = false;
private void iconButtonMinimize_Click(object sender, EventArgs e)
{
try
{
bunifuGradientPanel1.Dock = DockStyle.None; // Un-dock
this.WindowState = FormWindowState.Minimized;
isMinimized = true;
}
catch (Exception)
{
//...
}
}
private void Form1_Resize(object sender, EventArgs e)
{
if (isMinimized == true)
{
bunifuGradientPanel1.Dock = DockStyle.Top; // Re-dock
bunifuGradientPanel1.Width = panelDesktop.Width; // maintain desired width
isMinimized = false;
}
}
For people experiencing this same error but with non-Banifu controls, just do the same as above, but substitute Dock for Visibility. Your control is not rendering on minimize. So set visible = false when minimized. Set visible = true when you resize.
Right... this morning I realized that this error happens for my Banifu control when it is Docked. If undocked the error does not occur. But I need to Dock mine.
THE OFFICAL BANIFU SUPPORT RESPONSE: Gradient Panel is being resized to a point where it cannot be rendered on minimize. We will provide a fix for this most in the next release. Most probably in the next release.
Cool, but I fixed it.
User contributions licensed under CC BY-SA 3.0