void __fastcall TForm4::Frame()
{
int margin=5;
int width=PaintBox1->Width-margin;
int height=PaintBox1->Height-margin;
PaintBox1->Canvas->Pen->Color=clGreen;
PaintBox1->Canvas->MoveTo(margin,margin);
PaintBox1->Canvas->LineTo(width,margin);
PaintBox1->Canvas->LineTo(width,height);
PaintBox1->Canvas->LineTo(margin,height);
PaintBox1->Canvas->LineTo(margin,margin);
}
void __fastcall TForm4::Diagonals()
{
int margin=5;
int width=PaintBox1->Width-margin;
int height=PaintBox1->Height-margin;
PaintBox1->Canvas->MoveTo(margin,margin);
PaintBox1->Canvas->LineTo(width,height);
PaintBox1->Canvas->MoveTo(width,margin);
PaintBox1->Canvas->LineTo(margin,height);
}
void __fastcall TForm4::Cross()
{
int margin=5;
int width=PaintBox1->Width-margin;
int height=PaintBox1->Height-margin;
int my_width=width/2;
int my_height=height/2;
PaintBox1->Canvas->Pen->Color=clRed;
PaintBox1->Canvas->MoveTo(margin,my_height);
PaintBox1->Canvas->LineTo(width,my_height);
PaintBox1->Canvas->MoveTo(my_width,margin);
PaintBox1->Canvas->LineTo(my_width,height);
}
void __fastcall TForm4::Circles()
{
int centrum_x=PaintBox1->Width/2;
int centrum_y=PaintBox1->Height/2;
int value=30;
PaintBox1->Canvas->Ellipse(centrum_x,centrum_y,value,value);
PaintBox1->Canvas->Ellipse(centrum_x,centrum_y,2*centrum_x-value,2*centrum_y-value);
}
void __fastcall TForm4::Rectangles()
{
int centrum_x=PaintBox1->Width/2;
int centrum_y=PaintBox1->Height/2;
int value=60;
PaintBox1->Canvas->Brush->Color=clYellow;
PaintBox1->Canvas->Rectangle(value,centrum_y,centrum_x-value,2*centrum_y-value);
PaintBox1->Canvas->Rectangle(centrum_x+value,value,2*centrum_x-value,centrum_y);
}
void __fastcall TForm4::Text()
{
int value=40;
int x_north=PaintBox1->Width/2;
int y_north=value;
int x_east=PaintBox1->Width-value;
int y_east=PaintBox1->Height/2;
int x_south=PaintBox1->Width/2;
int y_south=PaintBox1->Height-value;
int x_west=value;
int y_west=PaintBox1->Height/2;
PaintBox1->Canvas->Brush->Color=clWhite;
PaintBox1->Canvas->TextOutW(x_north,y_north,"North");
PaintBox1->Canvas->TextOutW(x_east,y_east,"East");
PaintBox1->Canvas->TextOutW(x_south,y_south,"South");
PaintBox1->Canvas->TextOutW(x_west,y_west,"West");
}
void __fastcall TForm4::Button1Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm4::Button2Click(TObject *Sender)
{
Frame();
Diagonals();
Cross();
Circles();
Rectangles();
Text();
}
//---------------------------------------------------------------------------
Brak komentarzy:
Prześlij komentarz