相信同类Delphi 类似文章很多了,这里我用c++ builder firemonkey 实现填充椭圆
本例主要在FormPaint实现,当然你想在Image1->Bitmap->Canvas这样的地方也可以,具体看官方示例吧。
void __fastcall TForm3::FormPaint(TObject *Sender, TCanvas *Canvas, const TRectF &ARect)
{
Canvas->BeginScene();
System::Types::TRectF* Rect=new System::Types::TRectF(0,0,100,100);
TRectF MyRect(50, 40, 200, 270);
TAlphaColorRec* mycolorRec=new TAlphaColorRec();
mycolorRec->R=160;
mycolorRec->G=60;
mycolorRec->B=60;
mycolorRec->A=255;
System::Uitypes::TAlphaColor mycolor(mycolorRec->Color);
TStrokeBrush* brush=new TStrokeBrush(TBrushKind::Solid, mycolor);
Canvas->DrawEllipse(*Rect,90,brush);
Canvas->FillEllipse(MyRect, 40,brush);
Canvas->EndScene();
}