zoukankan      html  css  js  c++  java
  • [DELPHI]TreeView精确定位到每一个ITEM

    procedure TForm1.TreeView1Click(Sender: TObject);
    var
      aPoint: TPoint;
      aNode: TTreeNode;
      aHitTest: THitTests;
    begin
      if GetCursorPos(aPoint) then
      begin
        aPoint := TreeView1.ScreenToClient(aPoint);
        aHitTest := TreeView1.GetHitTestInfoAt(aPoint.X, aPoint.Y);

        //htOnItem, htOnButton, htOnIcon, htOnIndent, htOnLabel
        if not ((htOnItem in aHitTest)or (htOnLabel in aHitTest)) then  Exit;

        aNode := TreeView1.GetNodeAt(aPoint.X, aPoint.Y);
        if not Assigned(aNode) then  Exit;

        //test: Caption := aNode.Text;
        //do your code
      end;
    end;

    procedure TForm1.TreeView1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    var
      aNode: TTreeNode;
    begin
      aNode := TreeView1.GetNodeAt(X, Y);
      if not Assigned(aNode) then  Exit;

      //do your code
    end;

  • 相关阅读:
    Lucene
    SQL优化以及索引
    Mysql优化
    RocketMQ
    RocketMQ
    Session共享
    Linux安装Nginx
    初识nginx
    跨域,防止表单重复提交
    HttpClient案例
  • 原文地址:https://www.cnblogs.com/moon25/p/1629635.html
Copyright © 2011-2022 走看看