标签:des style http color strong io for 问题
有问题
//ListBox选中的项目移动到第1位
Listbox1.Items.Move(ListBox1.ItemIndex,0);
//ListView选中的项目移动到第1位
procedure
TForm1.Button5Click(Sender: TObject);
var
sel:String;
begin
with ListView1 do
begin
sel:=Selected.Caption;
Items.Insert(0).caption:=sel;
DeleteSelected;
SetFocus;
Items[0].Selected:=True;
end;
end;
//TreeView选中的项目移动到第1位
//ListView上移 和下移
procedure
ListViewItemMoveUpDown(lv: TListView; Item: TListItem; MoveUp, SetFocus:
Boolean);
var
DestItem:
TListItem;
begin
if (Item = nil) or
((Item.Index - 1 < 0) and MoveUp) or
((Item.Index + 1 >= lv.Items.Count) and
(not MoveUp))
then
Exit;
lv.Items.BeginUpdate;
try
if MoveUp then
DestItem
:= lv.Items.Insert(Item.Index - 1)
else
DestItem
:= lv.Items.Insert(Item.Index + 2);
DestItem.Assign(Item);
lv.Selected
:=
DestItem;
Item.Free;
finally
lv.Items.EndUpdate;
end;
if SetFocus then
lv.SetFocus;
DestItem.MakeVisible(False);
end;
procedure TForm1.Button3Click(Sender:
TObject);
begin
ListViewItemMoveUpDown(ListView1,
ListView1.Selected, True, True);//é?ò?
end;
procedure TForm1.Button4Click(Sender:
TObject);
begin
ListViewItemMoveUpDown(ListView1,
ListView1.Selected, False, True);//??ò?
end;
标签:des style http color strong io for 问题
原文地址:http://www.cnblogs.com/xe2011/p/3876253.html