void __fastcall TForm1::Image2MouseMove(TObject *Sender, TShiftState Shift,
int X, int Y)
{
if (Dragging)
{
Canvas->DrawFocusRect(DrawRect);
DrawRect.right = X;
DrawRect.bottom = Y;
Canvas->DrawFocusRect(DrawRect);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Image2MouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
Dragging = true;
DrawRect.left = X;
DrawRect.top = Y;
DrawRect.right = X;
DrawRect.bottom = Y;
Canvas->DrawFocusRect(DrawRect);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Image2MouseUp(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
if (Dragging) {
Dragging = false;
Canvas->DrawFocusRect(DrawRect);
Graphics::TBitmap* bmp = new Graphics::TBitmap();
bmp->Height = Image2->Height;
bmp->Width = Image2->Width;
bmp->Assign(Image2->Picture->Graphic);
juntas->Canvas->CopyRect(Rect(0, 0, juntas->Width, juntas->Height), bmp->Canvas, DrawRect);
}
}