用RectInRegion判断看看<br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, StdCtrls, Buttons;<br><br>type<br> TForm1 = class(TForm)<br> btn1: TBitBtn;<br> procedure FormPaint(Sender: TObject);<br> procedure btn1Click(Sender: TObject);<br> procedure FormCreate(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br> RGN: HRGN;<br> Rect: TRect;<br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.FormPaint(Sender: TObject);<br>begin<br> Canvas.Rectangle(10, 10, 100, 100);<br> Canvas.Ellipse(50, 50, 150, 150);<br>end;<br><br>procedure TForm1.btn1Click(Sender: TObject);<br>begin<br> if RectInRegion(RGN, rect) then<br> ShowMessage('in');<br>end;<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br> RGN := CreateEllipticRgn(50, 50, 150, 150);<br> SetRect(Rect, 10, 10, 100, 100);<br>end;<br><br>end.