verschiedene Hints in einem Treeview anzeigen

void __fastcall TfrmMain::FormCreate(TObject *Sender)
{
    Application->ShowHint = true;
    Application->OnShowHint = DoShowHint;
    Application->HintPause = 10;
}
//---------------------------------------------------------------------------
void __fastcall TfrmMain::DoShowHint(System::AnsiString &HintStr, bool &CanShow, THintInfo &HintInfo)
{
    if (HintInfo.HintControl->ClassNameIs("TTreeView"))
    {
        HintInfo.HintMaxWidth = 200;
        HintInfo.HintPos.x += 10;
        HintInfo.ReshowTimeout = 50;
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmMain::TreeViewMouseMove(TObject *Sender, TShiftState Shift, int X, int Y)
{
    if (Sender->ClassNameIs("TTreeView"))
    {
        TTreeNode *Node;
        Node = ((TTreeView*)Sender)->GetNodeAt(X, Y);

        if (Node == NULL)
        {
            ((TTreeView*)Sender)->ShowHint = false;
        }
        else
        {
            ((TTreeView*)Sender)->Hint = Node->Text;
            ((TTreeView*)Sender)->ShowHint = true;
        }
    }
}

Kommentare sind geschlossen.