Image PaintBox. Canvas (), . ,
Form1->Canvas->Rectangle(20, 20, 60, 60);
.
Canvas, .
MoveTo(x, y) | ( ) |
LineTo(x1, y1) | (x1, y1) |
Polyline(points, n) | ; points (. ), n |
Rectangle(x1, y1, x2, y2) | , x1, y1, x2, y2 - . |
FillRect(x1, y1, x2, y2) | |
Ellipse(x1, y1, x2, y2) | . X1, y1, x2, y2 , |
Arc(x1, y1, x2, y2, x3, y3, x4, y4) | . x1, y1, x2, y2 , , x3, y3, x4, y4 |
Pie(x1, y1, x2, y2, x3, y3, x4, y4) | . (x3, y3) (x4, y4) |
TextOutA(x, y, ) | , . x, y , |
Pixels[x][y] Canvas. , (50, 50):
Form1->Canvas->Pilxels[50][50]=clRed;
clRed , .
RGB(red, green, blue), red, green, blue , (0, 255), :
Form1->Canvas->Pilxels[50][50]=RGB(0, 163, 78);
. Pen () Brush () (Canvas), . , Canvas, . Pen Brush .
Pen
Color | |
Width | ( ) |
Style | . psSolid ; psClear ; psDash ; psDot ; psDashDot |
|
|
Brush
Color | |
Style | . bsSolid ; bsHorizontal ; bsVertical ; bsFDiagonal ; bsBDiagonal ; bsCross ; bsDiagCross |
Font . Font.
C Font
Name | . , Arial |
Size | |
Style | . : fsBold ; fsItalic ; fsUnderline ; fsStrikeOut |
Color | . , clRed, RGB() |
1. PaintBox .
. PaintBox ( Win32) Button. :
void __fastcall TForm1::Button1Click(TObject *Sender)
{
PaintBox1->Canvas->Pixels[10][10]=clRed;
PaintBox1->Canvas->MoveTo(50,50);
PaintBox1->Canvas->LineTo(100,100);
}
2. .
OnPaint () . OnPaint :
void __fastcall TForm1::FormPaint(TObject *Sender)
{
Form1->Canvas->Ellipse(40,40,140,140);
}
3. Pen Brush.
Button. :
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Form1->Canvas->Brush->Color=clRed;
Form1->Canvas->Brush->Style=bsCross;
Form1->Canvas->Pen->Width=3;
Form1->Canvas->Ellipse(40,40,140,140);
}
4. .
OnPaint. :
void __fastcall TForm1::FormPaint(TObject *Sender)
{
Form1->Canvas->Ellipse(40,40,140,140);
Form1->Canvas->Font->Name="Times New Roman";
Form1->Canvas->Font->Size=20;
Form1->Canvas->Font->Color=clBlue;
Form1->Canvas->TextOutA(100, 5, " C++ Builder");
}
.
, (x) = sin(x)ex/5 x.