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