zoukankan      html  css  js  c++  java
  • GdiPlus[19]: IGPPathGradientBrush 之 SetCenterPoint


    测试效果图:



    测试代码:

    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs;
    
    type
      TForm1 = class(TForm)
        procedure FormPaint(Sender: TObject);
        procedure FormMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    uses GdiPlus, GdiPlusHelpers;
    
    var
      Pt: TGPPointF;
    
    procedure TForm1.FormPaint(Sender: TObject);
    var
      Brush: IGPPathGradientBrush;
      Rect: TGPRect;
      Path: IGPGraphicsPath;
    begin
      Rect.Initialize(10, 10, 200, 150);
      Path := TGPGraphicsPath.Create;
      Path.AddEllipse(Rect);
    
      Brush := TGPPathGradientBrush.Create(Path);
      Brush.CenterColor := $FF00FF00;
      Brush.SetSurroundColors([$FF000000]);
    
      Brush.SetCenterPoint(Pt);
    
      Canvas.ToGPGraphics.FillEllipse(Brush, Rect);
      Canvas.ToGPGraphics.DrawRectangle(TGPPen.Create($FFFF0000), Pt.X-3, Pt.Y-3, 6, 6);
    end;
    
    procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    begin
      Pt.X := X;
      Pt.Y := Y;
      Repaint;
    end;
    
    end.
    
  • 相关阅读:
    IP 协议
    以太网协议
    制作Win10系统安装U盘和安装纯净版Win10
    IP地址的配置
    进制转换
    设置QQ环境变量
    修改IE默认页的指向
    虚拟机安装Linux ubuntu19.10
    【Eclipse】Editor does not contain a main type
    Vmware Workstation虚拟机
  • 原文地址:https://www.cnblogs.com/del/p/1624617.html
Copyright © 2011-2022 走看看