Treeview-Item unter dem Mauscursor ermitteln

void __fastcall TForm1::TreeView1DblClick(TObject *Sender)
{
    TPoint P = Mouse->CursorPos;
    P = MenuTreeView->ScreenToClient(P);

    THitTests HT = MenuTreeView->GetHitTestInfoAt(P.x,P.y);
    TTreeNode *pItem = MenuTreeView->GetNodeAt(P.x,P.y);

    if (HT.Contains(htOnItem) || HT.Contains(htOnIcon))
    {
        AnsiString S = AnsiString("Item an Position ") + AnsiString(pItem->Level);
        ShowMessage(S);
    }
}

Kommentare sind geschlossen.