upolybezier.pas

来自「Delphi Win32核心API参考光盘源码 本书包含了常用的Windows」· PAS 代码 · 共 50 行

PAS
50
字号
unit UPolyBezier;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    procedure FormPaint(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormPaint(Sender: TObject);
var
  Points: array[0..6] of TPoint; // points defining the bezier curver
begin
  {define the bezier curve}
  Points[0].X := 10;
  Points[0].Y := 50;
  Points[1].X := 40;
  Points[1].Y := 90;
  Points[2].X := 80;
  Points[2].Y := 10;
  Points[3].X := 110;
  Points[3].Y := 50;
  Points[4].X := 140;
  Points[4].Y := 10;
  Points[5].X := 180;
  Points[5].Y := 90;
  Points[6].X := 210;
  Points[6].Y := 50;

  {draw the bezier curve}
  PolyBezier(Canvas.Handle, Points, 7);
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?