Mega Code Archive
How to draw an underline on a Listview Caption
Title: How to draw an underline on a Listview Caption
Question: Can you underline the caption of a ListView Item?
Answer:
To draw an Underline on a Listview Caption the same like the HotTrack function in Delphi 6 in Delphi 3 you must call an API function.
In the Uses Clausse inpelement the CommCtrl unit.
Then you set the following code in the MouseMove property of your ListView.
procedure TfrmMain.lvwMainMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
const
LVS_EX_UNDERLINEHOT = $00000800;
var
AItem : TListItem;
Styles : DWord;
begin
AItem := lvwMain.GetItemAt(X, Y);
if not Assigned(AItem) then
begin
lvwMain.Cursor := crArrow;
end
else
begin
lvwMain.Cursor := crHandPoint;
Styles := Trunc(Styles + LVS_EX_UNDERLINEHOT - LVS_EX_CHECKBOXES - LVS_EX_FULLROWSELECT);
ListView_SetExtendedListViewStyle(lvwMain.Handle, Styles);
end;
end;
When you goes with your mouse over an ListView Item there will be an underline drawed under the caption of the Item.