这是我按下自定义最小化按钮时得到的错误消息。
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)
答案 0 :(得分:0)
当我开始使用新的自定义控件时,尝试使用自定义按钮最小化时遇到了相同的错误。在查看详细的异常消息之前,我无法弄清楚。
System.ArgumentException
HResult = 0x80070057
Message =参数无效。
来源= System.Drawing
StackTrace:
在System.Drawing.Bitmap..ctor(Int32宽度,Int32高度,PixelFormat格式)
在System.Drawing.Bitmap..ctor(Int32宽度,Int32高度)
在Bunifu.UI.WinForms.BunifuGradientPanel.Refresh()
在Bunifu.UI.WinForms.BunifuGradientPanel.OnResize(EventArgs eventargs)
这是新的BunifuGradientPanel,以前运行良好,一整天都在减少,但是我离开VS几个小时,当我返回时开始出错。奇怪。
我不确定,但我怀疑bunifuGradientPanel1无法正确处理自身。
要解决此问题,只需执行此操作。
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;
}
}
对于遇到相同错误但使用非Banif控件的用户,请执行与上述相同的操作,但用Dock代替“可见性”。您的控件未呈现在最小化上。因此,最小化时将visible设置为false。调整大小时,将visible设置为true。
对...今天早晨,我意识到,当我的Banifu控件停靠时,会发生此错误。如果取消对接,则不会发生该错误。但是我需要停靠我的。
官方的BANIFU支持响应:渐变面板的大小已调整到无法最小化的程度。我们将在下一版本中为此提供最多的修复程序。很有可能在下一个版本中。
很酷,但我已解决。