以下为异常信息:
Type : System.ComponentModel.Win32Exception, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : 创建窗口句柄时出错。
Source : System.Windows.Forms
Help link :
NativeErrorCode : 1158
ErrorCode : -2147467259
Data : System.Collections.ListDictionaryInternal
TargetSite : Void CreateHandle(System.Windows.Forms.CreateParams)
Stack Trace : 在 System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
在 System.Windows.Forms.Control.CreateHandle()
在 System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
在 System.Windows.Forms.Control.CreateControl()
在 System.Windows.Forms.Control.ControlCollection.Add(Control value)
在 (这里是程序中的方法)
Type : System.ComponentModel.Win32Exception, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : 创建窗口句柄时出错。
Source : System.Windows.Forms
Help link :
NativeErrorCode : 1158
ErrorCode : -2147467259
Data : System.Collections.ListDictionaryInternal
TargetSite : Void CreateHandle(System.Windows.Forms.CreateParams)
Stack Trace : 在 System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
在 System.Windows.Forms.Control.CreateHandle()
在 System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
在 System.Windows.Forms.Control.CreateControl()
在 System.Windows.Forms.Control.ControlCollection.Add(Control value)
在 (这里是程序中的方法)
你是不是屏蔽了base.WndProc函数?
btn.Width = "变量";
btn.Left = "变量"; //显示的行数固定
btn.Height = "变量";
btn.Top = "变量"; btn.Name = "变量";
Panel1.Controls.Add(btn);
每个5分钟刷新一次,那么会创建很多button吧...
这些事件里面没有用异常去扑获.
MouseEventArgs arg = (MouseEventArgs)e;
Button btn = (Button)sender;
然后直接操作btn
加入动态生成了10000个左右的控件比如说10000BUTTON,就会抛出异常, 有解决方法吗?
想这种定时处理的一般不是文本,就是数据库...
楼主最好还是重新设计吧,感觉你这个5分钟1个button的也不是放在前台给客户用的,不然谁能用那么多button