随笔 - 2146  文章 - 97 评论 - 11758 trackbacks - 253


测试效果图:



测试代码:

uses GdiPlus, GdiPlusHelpers;

procedure TForm1.FormPaint(Sender: TObject);
const
  C1 = $FF000000;
  C2 = $FFFF0000;
  C3 = $FFFFFF00;
  C4 = $FFFF0000;
  C5 = $FF000000;
var
  Brush: IGPPathGradientBrush;
  Rect: TGPRect;
  Path: IGPGraphicsPath;
  ColorBlend: IGPColorBlend;
begin
  Rect.Initialize(10, 10, 180, 100);
  Path := TGPGraphicsPath.Create;
  Path.AddEllipse(Rect);

  Brush := TGPPathGradientBrush.Create(Path);
  ColorBlend := TGPColorBlend.Create([C1, C2, C3, C4, C5], [0, 0.25, 0.5, 0.75, 1]);
  Brush.InterpolationColors := ColorBlend;

  Canvas.ToGPGraphics.FillEllipse(Brush, Rect);
end;

posted on 2009-12-15 13:37 万一 阅读(...) 评论(...) 编辑 收藏