void __fastcall TForm1::FormMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { i=0; bh[i]=X; gh[i]=Y; i++; } //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { FormMouseDown(Sender, mbLeft , TShiftState() << ssLeft, bh[0], gh[0]); FormMouseDown(Sender, mbLeft , TShiftState() << ssLeft, bh[1], gh[1]); Form1->Canvas->Rectangle(bh[0],gh[0],bh[1],gh[1]); Edit1->Text= IntToStr(bh[0])+" "+IntToStr(gh[0])+" "+IntToStr(bh[1])+" "+IntToStr(gh[1]); }