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         }


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

  • 相关阅读:
    sublime text3中html的使用
    WEB如何入门?各种渗透攻击如何入门?
    考思科认证NA过程的学习笔记
    HTML URL 编码(学习笔记)
    学习HTML过程中的笔记
    必学
    playfair密码
    二三级计算机考试时间
    DAY 135 VUE
    DAY 134 RBAC
  • 原文地址:https://www.cnblogs.com/yy3b2007com/p/3473975.html
Copyright © 2011-2022 走看看