GdiPlus[20]: IGPPathGradientBrush 之 SetFocusScales


测试效果图:

GdiPlus[20]: IGPPathGradientBrush 之 SetFocusScales

测试代码:


uses GdiPlus;



procedure TForm1.FormPaint(Sender: TObject);

var

  Graphics: IGPGraphics;

  Brush: IGPPathGradientBrush;

  Rect: TGPRect;

  Path: IGPGraphicsPath;

begin

  Graphics := TGPGraphics.Create(Handle);

  Rect.Initialize(10, 10, 180, 100);

  Path := TGPGraphicsPath.Create;

  Path.AddEllipse(Rect);



  Brush := TGPPathGradientBrush.Create(Path);

  Brush.CenterColor := $FF00FF00;

  Brush.SetSurroundColors([$FF000000]);



  Brush.SetFocusScales(0, 0); //这是默认设置

  Graphics.FillEllipse(Brush, Rect);



  Brush.SetFocusScales(0.5, 0);

  Graphics.TranslateTransform(0, Rect.Y + Rect.Height);

  Graphics.FillEllipse(Brush, Rect);



  Brush.SetFocusScales(0, 0.5);

  Graphics.TranslateTransform(0, Rect.Y + Rect.Height);

  Graphics.FillEllipse(Brush, Rect);

end;


 
   

你可能感兴趣的:(focus)