//---------------------------------------------------------------------------
__fastcall
TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
ScreenCanvas = new TCanvas();
}
//--------------------------------------------------------------------------------
void
__fastcall TForm1::Button1Click(TObject *Sender)
{
ScreenCanvas->Pen->Color = clBlue;
ScreenCanvas->Pen->Width = 4;
ScreenCanvas->Handle = GetDC(0);
TPoint P1, P2;
P1.x = Image1->BoundsRect.Left;
P1.y = Image1->BoundsRect.Bottom;
P2.x = Image2->BoundsRect.Right;
P2.y = Image2->BoundsRect.Top;
ScreenCanvas->MoveTo(ClientToScreen(P1).x, ClientToScreen(P1).y);
ScreenCanvas->LineTo(ClientToScreen(P2).x, ClientToScreen(P2).y);
ReleaseDC(0, ScreenCanvas->Handle);
}
//--------------------------------------------------------------------------------
void
__fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
delete ScreenCanvas;
}
|