1.整行都变蓝:
const LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54;
LVS_EX_GRIDLINES = $00000001;
LVS_EX_SUBITEMIMAGES = $00000002;
LVS_EX_CHECKBOXES = $00000004;
LVS_EX_TRACKSELECT = $00000008;
LVS_EX_HEADERDRAGDROP = $00000010;
LVS_EX_FULLROWSELECT = $00000020; {applies to report mode
only}
LVS_EX_ONECLICKACTIVATE = $00000040;
LVS_EX_TWOCLICKACTIVATE = $00000080;SendMessage (ListView.Handle, LVM_SETEXTENDEDLISTVIEWSTYLE,
0, LVS_EX_FULLROWSELECT or LVS_EX_TRACKSELECT);2. 排序From the Delphi 5 help (but also applies to Delphi 4):This example shows how to use the OnColumnClick and OnCompare events of a
list view to let users sort the columns in a report-style list view by
clicking on the column headers. This requires a global variable to keep
track of the column that was clicked: var ColumnToSort: Integer;The OnColumnClick event handler sets the global variable to indicate the
column to sort and calls AlphaSort: procedure TForm1.ListView1ColumnClick(Sender: TObject; Column:
TListColumn);
begin
ColumnToSort := Column.Index;
(Sender as TCustomListView).AlphaSort;
end;
The OnCompare event handler causes the list view to sort on the selected
column: procedure TForm1.ListView1Compare(Sender: TObject; Item1, Item2:
TListItem; Data: Integer; var Compare: Integer);
var
ix: Integer;
begin
if ColumnToSort = 0 then
Compare := CompareText(Item1.Caption,Item2.Caption)
else begin
ix := ColumnToSort - 1;
Compare := CompareText(Item1.SubItems[ix],Item2.SubItems[ix]);
end;
end;
const LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54;
LVS_EX_GRIDLINES = $00000001;
LVS_EX_SUBITEMIMAGES = $00000002;
LVS_EX_CHECKBOXES = $00000004;
LVS_EX_TRACKSELECT = $00000008;
LVS_EX_HEADERDRAGDROP = $00000010;
LVS_EX_FULLROWSELECT = $00000020; {applies to report mode
only}
LVS_EX_ONECLICKACTIVATE = $00000040;
LVS_EX_TWOCLICKACTIVATE = $00000080;SendMessage (ListView.Handle, LVM_SETEXTENDEDLISTVIEWSTYLE,
0, LVS_EX_FULLROWSELECT or LVS_EX_TRACKSELECT);2. 排序From the Delphi 5 help (but also applies to Delphi 4):This example shows how to use the OnColumnClick and OnCompare events of a
list view to let users sort the columns in a report-style list view by
clicking on the column headers. This requires a global variable to keep
track of the column that was clicked: var ColumnToSort: Integer;The OnColumnClick event handler sets the global variable to indicate the
column to sort and calls AlphaSort: procedure TForm1.ListView1ColumnClick(Sender: TObject; Column:
TListColumn);
begin
ColumnToSort := Column.Index;
(Sender as TCustomListView).AlphaSort;
end;
The OnCompare event handler causes the list view to sort on the selected
column: procedure TForm1.ListView1Compare(Sender: TObject; Item1, Item2:
TListItem; Data: Integer; var Compare: Integer);
var
ix: Integer;
begin
if ColumnToSort = 0 then
Compare := CompareText(Item1.Caption,Item2.Caption)
else begin
ix := ColumnToSort - 1;
Compare := CompareText(Item1.SubItems[ix],Item2.SubItems[ix]);
end;
end;
LVM_FIRST = $00001000
你的这个十六进制是怎么编码的,我看了一下没发现规律