码迷,mamicode.com
首页 > Windows程序 > 详细

意外发现了winform的一个控件个数的极限

时间:2015-04-20 16:57:00      阅读:312      评论:0      收藏:0      [点我收藏+]

标签:控件个数的极限   winform   c#   windows   

很久没来CSDN了,今天跟大家分享一个我的发现,调试这个的时间用了很久,希望大家在遇到类似问题时,不要走弯路.

如下图,我用反射在一个窗体上根据从数据库里取来的数据创建自定义控件,当完成1169个之后创建第1170个,而且每次都是在1170时,会报错,如下图.


有时则直接说发生 了一个异常,根本没把这个错误报出来.

大概是微软觉得你肯定不会在同一个窗体上创建1000多个控件吧.....技术分享托管(v4.0.30319)): 已加载“C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Transactions.resources\v4.0_4.0.0.0_zh-Hans_b77a5c561934e089\System.Transactions.resources.dll”
System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>未处理的异常</Description><AppDomain>YDHfw2015.vshost.exe</AppDomain><Exception><ExceptionType>System.ComponentModel.Win32Exception, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>创建窗口句柄时出错。</Message><StackTrace>   在 System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
   在 System.Windows.Forms.ToolTip.CreateHandle()
   在 System.Windows.Forms.ToolTip.get_TopLevelControl()
   在 System.Windows.Forms.ToolTip.CreateRegion(Control ctl)
   在 System.Windows.Forms.ToolTip.HandleCreated(Object sender, EventArgs eventargs)
   在 System.Windows.Forms.Control.OnHandleCreated(EventArgs e)
   在 System.Windows.Forms.Control.WmCreate(Message&amp;amp; m)
   在 System.Windows.Forms.Control.WndProc(Message&amp;amp; m)
   在 System.Windows.Forms.Label.WndProc(Message&amp;amp; m)
   在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp;amp; m)
   在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp;amp; m)
   在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)</StackTrace><ExceptionString>System.ComponentModel.Win32Exception (0x80004005): 创建窗口句柄时出错。
   在 System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
   在 System.Windows.Forms.ToolTip.CreateHandle()
   在 System.Windows.Forms.ToolTip.get_TopLevelControl()
   在 System.Windows.Forms.ToolTip.CreateRegion(Control ctl)
   在 System.Windows.Forms.ToolTip.HandleCreated(Object sender, EventArgs eventargs)
   在 System.Windows.Forms.Control.OnHandleCreated(EventArgs e)
   在 System.Windows.Forms.Control.WmCreate(Message&amp;amp; m)
   在 System.Windows.Forms.Control.WndProc(Message&amp;amp; m)
   在 System.Windows.Forms.Label.WndProc(Message&amp;amp; m)
   在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp;amp; m)
   在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp;amp; m)
   在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)</ExceptionString><NativeErrorCode>486</NativeErrorCode></Exception></TraceRecord>

意外发现了winform的一个控件个数的极限

标签:控件个数的极限   winform   c#   windows   

原文地址:http://blog.csdn.net/yuandonghuia/article/details/45151231

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!