马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 『C.』Study... 于 2012-6-14 11:05 编辑
最近做一个Case就是遇到这样的事,用一个PopupMenu为Listview的子项使用。下面是代码;写的有点乱,不过能用;
第一步先在你的你的Form的OnCretae事件中添加代码;
procedure TForm1.FormCreate(Sender: TObject);
var
i:Integer;
begin
for i:=0 to PopupMenu1.Items.Count -1 do
begin
PopupMenu1.Items.Visible :=false;
end;
end;//这个循环的作用是初始化PopupMenu的所有子项为不可见;
procedure TForm1.ListView1ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
var
i, j, s, a:Integer;
begin
ListView1.Update;
for i:=0 to ListView1.Items.Count - 1 do
begin
if ListView1.Items.Count >0 then
begin
for a:=0 to ListView1.Items.Count +1 do</