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         }


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

  • 相关阅读:
    30 tcp编码, udp编码 pycharm输出带颜色, tcp实现的聊天室
    29 网络相关知识 socket
    c++ 程序
    solr 5.4安装
    Linux之ss
    filezilla 证书使用
    mongodb安装,使用
    wireshark抓包发现1506字节包
    python之模块的显要属性
    正则表达式之去除空行
  • 原文地址:https://www.cnblogs.com/yy3b2007com/p/3473975.html
Copyright © 2011-2022 走看看