TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
fDraw = true;
fFirstDraw = true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::DrawLines(void)
{
this->Repaint();
int hMax = this->ClientHeight;
int wMax = this->ClientWidth;
// linia pionowa
this->Canvas->MoveTo(fPoint.x, 0);
this->Canvas->LineTo(fPoint.x, hMax);
// linia pozioma
this->Canvas->MoveTo(0, fPoint.y);
this->Canvas->LineTo(wMax, fPoint.y);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormMouseMove(TObject *Sender, TShiftState Shift, int X,
int Y)
{
if( fDraw )
{
this->Canvas->Pen->Mode = pmNotXor;
if( fFirstDraw == false ) DrawLines(); // wymazanie poprzednich linii
fPoint.x = X;
fPoint.y = Y;
fFirstDraw = false;
DrawLines();
}
}