delphi中如何检测鼠标的左键和右键同时按下?
mousedown事件中
if(Button=mbleft)and(Button=mbright)
beign
...
end
好像没有用啊

解决方案 »

  1.   

    放一个Panel,在MousDown事件中
    procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    begin
      if (ssLeft in Shift) and (ssRight in Shift) then
      ShowMessage('Left and Right Button all Down!')
    end;
      

  2.   

    如果是在指定的控件上检测鼠标的左键和右键同时按下时,就在该控件的OnMouseDown事件中添写检测代码:if (ssLeft in Shift) and (ssRight in Shift) then
      ShowMessage('Left and Right Button all Down!').
    如果要在所有控件上检测的话,最好还是写消息事件。