同标题

解决方案 »

  1.   

    procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    begin
      if button=mbleft then showmessage('左键');
      if button=mbright then showmessage('右键');
    end;
      

  2.   

    procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    begin
     if  Button=mbLeft then showMessage('左键')
     if  Button=mRight then showMessage('右键')end;
      

  3.   

    procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    判断按下的是鼠标左键  Button=mbLeft  右键Button=mbRight
      

  4.   

    大家都是说在MouseDown事件里来判断,那又没有直接判断的方法,鼠标按下时,挥发个消息给窗体,那窗体在接受这个消息后,会不会吧鼠标得按下状态保存起来?呵呵,小弟很菜!TO:----->yesxwl() 
       来晚也有分:)
      

  5.   

    我想要,if 鼠标是按下的 then……
    不只可不可以??
      

  6.   

    在Form1的public中声明过程
    public
        { Public declarations }
        Procedure ActiveControlChanged(sender:Tobject);
        Procedure WndProc(var message:Tmessage);
    在form1的Onlic中
    procedure TForm1.FormCreate(Sender: TObject);
    begin
         Form1.WindowProc:=WndProc;
    end;wndproc实现:
    procedure TForm1.WndProc(var message: Tmessage);
    begin
    case Message.Msg of
     WM_LButtonDown:showmessage('左键');
     WM_RButtonDown:showMessage('右键');
     end;
     Inherited WndProc(Message);
    end;
      

  7.   

    Pubic 中Procedure ActiveControlChanged(sender:Tobject);不要
      

  8.   

    在Form1的public中声明过程
    public
        { Public declarations }
        Procedure ActiveControlChanged(sender:Tobject);
        Procedure WndProc(var message:Tmessage);
    在form1的Onlic中
    procedure TForm1.FormCreate(Sender: TObject);
    begin
         Form1.WindowProc:=WndProc;
    end;wndproc实现:
    procedure TForm1.WndProc(var message: Tmessage);
    begin
    case Message.Msg of
     WM_LButtonDown:showmessage('左键');
     WM_RButtonDown:showMessage('右键');
     end;
     Inherited WndProc(Message);
    end;
      

  9.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, ExtCtrls, StdCtrls;type
      TMainForm = class(TForm)
        lst1: TListBox;
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
        procedure ApplicationIdle(Sender: TObject; var Done: Boolean);
      public
        { Public declarations }  end;var
      MainForm: TMainForm;implementation{$R *.dfm}procedure TMainForm.FormCreate(Sender: TObject);
    begin
      Application.OnIdle := ApplicationIdle;
    end;procedure TMainForm.ApplicationIdle(Sender: TObject; var Done: Boolean);
    begin
      if GetAsyncKeyState(VK_LBUTTON) < 0 then
        ShowMessage('左键按下');
      if GetAsyncKeyState(VK_RBUTTON) < 0 then
        ShowMessage('右键按下');
    end;end.就是
    GetAsyncKeyState函数,返回的Short如果最高位为1就是被按下
      

  10.   

    to tongki_8(矛盾与迟纯)
    老兄,抄得时候也要替我改改
    在form1的Onclick中