BCB中基本图形的绘制

 void __fastcall TForm1::FormPaint(TObject *Sender)
{
   //绘制点
    for (int i = 0; i < 120; i++)
        Canvas->Pixels[i][300] = clGreen;

    //绘制线
    Canvas->Pen->Color = clRed;
    Canvas->Pen->Style = psDashDot;
    Canvas->MoveTo(0, 0);
    Canvas->LineTo(100, 100);

    //绘制折线
    TPoint pt[3];
    pt[0] = Point(100, 10);
    pt[1] = Point(100, 30);
    pt[2] = Point(150, 40);
    Canvas->Brush->Color = clTeal;
    Canvas->Polyline(pt, 3);

    //绘制椭圆
    Canvas->Brush->Color = clRed;
    Canvas->Ellipse(0, 300, 20, 200);

    //绘制矩形
    Canvas->Rectangle(20, 50, 80, 100);

    //绘制文字
    Canvas->Font->Height = 50;
    Canvas->Font->Charset = GB2312_CHARSET;
    Canvas->TextOutA(200, 100, "Hello World");

}

你可能感兴趣的:(图形)