TA的每日心情 | 奋斗 2025-3-16 16:30 |
---|
签到天数: 11 天 [LV.3]偶尔看看II
|
转自:http://www.solokey.cn/
允许多选的ListBox需要加判断.可以参考被注释掉的代码.不再赘述.
//OnMouseUp:
var
  APoint: TPoint;
  Index: Integer;
begin
  if Button=mbRight then
  begin
    APoint.x := X;
    APoint.y := Y;
    Index := ListBox.ItemAtPos(APoint, True);
    {if (ListBox.SelCount <= 1) and  (Index >= 0) then begin
      SelectedListBox(False);
      LMDListBox.Selected[Index] := True;
    end;}
    {if (LMDListBox.SelCount > 0) and (Index >= 0) and LMDListBox.Selected[Index]  then
    begin
      ListBox.ItemIndex:=Index;}
      GetCursorPos(APoint);
     { InitPopupMenu(Index,PopupMenu);}//根据选中的Item对PopupMenu的MenuItem进行调整.可选
      PopupMenu.Popup(APoint.x,APoint.y);
   { end;}
  end;
end; |
|