比如我要判断鼠标的坐标是不是0,0
如果是就置LABEL1可见,否则LABEL1不可见。
最好能给个例子,谢谢。

解决方案 »

  1.   

    Mouse.CursorPos.X
    Mouse.CursorPos.Y
      

  2.   

    OnMouseMove啊,有它的位置信息的,取下来用就行了:)
      

  3.   

    点(0,0)不好找,此程序在(100,100)label1不可见。
    procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    begin
      Form1.Caption:=Format('Origin:(%d,%d)',[x,y]);
      if (x=100) and (y=100) then
      label1.Visible:=false
      else label1.Visible:=true;
    end;
      

  4.   

    var
      p: TPoint;
    begin
      GetCursorPos(p);
      if p.X=0 and p.Y=0 then
        Label1.Visble := True
      else
        Label1.Visble := False;
    end;
      

  5.   

    声明变量:
    var
      MP: TPoint;
    获得鼠标位置:
      GetCursorPos(MP);
    鼠标的横坐标:
      MP.X
    鼠标的纵坐标:
      MP.Y比如说弹出一个菜单procedure PopupAMenu;
    var
      MP: TPoint;
      GetCursorPos(MP);
    begin
      AMenu.Popup(MP.X; MP.Y)
    end;
      

  6.   

    接上面:下面的代码放到OnMouseMove里面if (MP.X := 0) and (MP.Y := 0) then
      label1.Visble := True
    else
      label1.Visble := False;