diff --git a/HZH_Controls/HZH_Controls/Controls/ScrollBar/ScrollbarComponent.cs b/HZH_Controls/HZH_Controls/Controls/ScrollBar/ScrollbarComponent.cs index 94ed52b7..cf847c0d 100644 --- a/HZH_Controls/HZH_Controls/Controls/ScrollBar/ScrollbarComponent.cs +++ b/HZH_Controls/HZH_Controls/Controls/ScrollBar/ScrollbarComponent.cs @@ -192,7 +192,8 @@ void control_SizeChanged(object sender, EventArgs e) { if (m_lstHCache[control].Visible) { - m_lstHCache[control].Parent.Controls.Remove(m_lstHCache[control]); + if (m_lstHCache[control].Parent != null) + m_lstHCache[control].Parent.Controls.Remove(m_lstHCache[control]); } } } @@ -405,6 +406,8 @@ private int GetTreeNodeMaxY(TreeView tv) private int GetTreeNodeMaxX(TreeView tv) { + if (tv.Nodes.Count == 0) return 0; + return tv.Nodes[0].Bounds.Right; } void tv_AfterSelect(object sender, TreeViewEventArgs e)