Fixed 鸟粪一样的TreeView下的NodeMouseDoubleClick Bug
1 private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { 2 Rectangle baseRectangle = this.treeView1.SelectedNode.Bounds; 3 Point mouseClickPoint = e.Location; 4 5 if (this.treeView1.SelectedNode == e.Node) { 6 if (WasInBounds(baseRectangle, mouseClickPoint)) { 7 MessageBox.Show(string.Format("the selected node text:{0}", e.Node.Text)); 8 } 9 } 10 } 11 12 /// <summary> 13 /// Return a value indicating whether the click point belong the reactangle region. 14 /// </summary> 15 /// <param name="baseRectangle"></param> 16 /// <param name="clickPoint"></param> 17 /// <returns></returns> 18 private static bool WasInBounds(Rectangle baseRectangle, Point clickPoint) { 19 bool result = true; 20 21 int bottom = baseRectangle.Bottom; 22 int right = baseRectangle.Right; 23 int left = baseRectangle.Left; 24 int top = baseRectangle.Top; 25 26 if ((clickPoint.X < left || clickPoint.X > right) || (clickPoint.Y > bottom || clickPoint.Y < top)) { 27 result = false; 28 } 29 30 return result; 31 }
废话不多说,用过的人看了代码自然明白
基础才是编程人员应该深入研究的问题,比如:
1)List/Set/Map内部组成原理|区别
2)mysql索引存储结构&如何调优/b-tree特点、计算复杂度及影响复杂度的因素。。。
3)JVM运行组成与原理及调优
4)Java类加载器运行原理
5)Java中GC过程原理|使用的回收算法原理
6)Redis中hash一致性实现及与hash其他区别
7)Java多线程、线程池开发、管理Lock与Synchroined区别
8)Spring IOC/AOP 原理;加载过程的。。。
【+加关注】。