zoukankan      html  css  js  c++  java
  • 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         }


    废话不多说,用过的人看了代码自然明白

  • 相关阅读:
    KMP+Tire树(模板)
    序列自动机(模板)
    欧拉函数(转载)
    Django之ContentType组件
    RestFramework之注册器、响应器与分页器
    RestFramework之频率组件
    RestFramework之权限组件
    RestFramework之认证组件
    RestFramework之视图组件
    RestFramework之序列化组件
  • 原文地址:https://www.cnblogs.com/yy3b2007com/p/3473975.html
Copyright © 2011-2022 走看看