PtInRegion好像可以,但是我不知道如何用,哪个大侠可以教教我

解决方案 »

  1.   

    function inornot(p:tpoint;rec:trect):boolean;
    begin
      result:=false;
      if (p.x>=rec1.aleft) and 
         (p.x<=rec1.aright) and
         (p.y<=rec1.abottom) and
         (p.x>=rec1.atop)  then 
      result:=true;
    end;
      

  2.   

    function inornot(p:tpoint;rec:trect):boolean;
    begin
      result:=false;
      if (p.x>=rec1.aleft) and 
         (p.x<=rec1.aright) and
         (p.y<=rec1.abottom) and
         (p.y>=rec1.atop)  then //改了一下
      result:=true;
    end;
      

  3.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      Rhnd:THandle;
      sRect:TRect;
    begin
      sRect := Rect(0,0,100,100);
      Rhnd:=CreateRectRgnIndirect(sRect);
      if PtInRegion(RHnd,x,y) then //点坐标(x,y)
      showmessage('Yes')
      else
      showmessage('No')
    end;
      

  4.   

    用laihecongxi(兴哥) 的。
    不过要用deleteobject(rhnd),
    不然你win98的资源就完了。
      

  5.   

    有一个windowsAPI函数:
    PtInRect可能写错了!!!
      

  6.   

    用PtInRect(const Rect: TRect; const P: TPoint): Boolean;判断点p是否在区域Rect中