ListBox弹出菜单自动选中

加PopupMenu1

Listbox1的PopupMenu属性设为PopupMenu1

procedure TForm1.ListBox1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);

begin
if Button=MBRight   then
   begin

     //自动发送左键点击信息
      Mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
      Mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
   end;
end;

你可能感兴趣的:(listbox)