Thomas, ich habe den Code aus meinem vorigen Beitrag ein wenig umgebaut und erweitert:
Delphi-Quellcode:
const
LINKCOLUMN = 2;
procedure TDemoForm.TreeDrawText(Sender: TBaseVirtualTree; TargetCanvas: TCanvas;
Node: PVirtualNode; Column: TColumnIndex; const Text: WideString; const CellRect: TRect;
var DefaultDraw: Boolean);
begin
if IsHotNode(Node) then
if (Column = LINKCOLUMN) and IsCursorInLinkColumn() then
TargetCanvas.Font.Style := TargetCanvas.Font.Style + [fsUnderline]
else
TargetCanvas.Font.Style := TargetCanvas.Font.Style - [fsUnderline];
end;
procedure TDemoForm.TreeMouseMove (Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
if IsHotNode(Tree.GetNodeAt(X, Y)) and IsCursorInLinkColumn() then
Tree.Cursor := crHandPoint
else
Tree.Cursor := crDefault;
end;
procedure TDemoForm.TreeClick (Sender: TObject);
begin
if IsHotNode(Tree.FocusedNode) and IsCursorInLinkColumn() then
ShowMessage (Tree.Text[Tree.FocusedNode, LINKCOLUMN]);
end;
function TDemoForm.IsHotNode (aNode: PVirtualNode): Boolean;
begin
Result := (toHotTrack in Tree.TreeOptions.PaintOptions)
and Assigned(aNode) and (aNode = Tree.HotNode);
end;
function TDemoForm.IsCursorInLinkColumn: Boolean;
begin
Result := (ColumnAtCursorPos() = LINKCOLUMN);
end;
function TDemoForm.ColumnAtCursorPos: TColumnIndex;
var
P: TPoint;
begin
P := Tree.ScreenToClient(Mouse.CursorPos);
Result := Tree.Header.Columns.ColumnFromPosition(P);
end;
Gruß Hawkeye