我已经通过设置TreeVIew来定制C#.NET中的外观
DrawMode=OwnerDrawAll; 那是,
OnDrawNode() 成功重写并绘制每个节点和连接线。所有的事情都很好,除了,我经常得到一个NullReference超负荷。下面是堆栈跟踪
at System.Windows.Forms.TreeNode.get_Handle()
at System.Windows.Forms.TreeNode.get_RowBounds()
at System.Windows.Forms.TreeView.CustomDraw(Message& m)
at System.Windows.Forms.TreeView.WmNotify(Message& m)
at System.Windows.Forms.TreeView.WndProc(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)
The message send to the WndProc during the exception is "WndProc(ref System.Windows.Forms.Message message = {msg=0x204e (WM_REFLECT + WM_NOTIFY)).我经常会得到以下步骤的异常:
有人想办法解决这个问题吗?
发布于 2014-01-14 08:43:47
我们发现
TreeNode.get_Handle()在通知自定义绘制期间抛出空引用异常。我不知道例外的原因。但是我已经通过处理"NM_CUSTOMDRAW“通知消息中的空引用异常来解决这个问题。
https://stackoverflow.com/questions/18058027
复制相似问题