⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 closefigureu.pas

📁 DelphiWin32核心API参考光盘内容.是学习书籍中的源码,便于学习.
💻 PAS
字号:
unit CloseFigureU;

interface

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

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

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
  {start a path bracket.  all subsequent drawing functions will define a
   path and will not produce visible output}
  BeginPath(Canvas.Handle);

  {start drawing a path}
  Canvas.MoveTo(65, 15);
  Canvas.LineTo(25, 234);
  Canvas.MoveTo(78, 111);
  Canvas.LineTo(98, 79);

  {if the path is incorrect, there was a mistake, or for any reason desired,
   the current path can be abandoned}
  AbortPath(Canvas.Handle);

  {the path was closed and abandoned, so we must start a new path bracket}
  BeginPath(Canvas.Handle);

  {draw three lines into the path}
  Canvas.MoveTo(25, 10);
  Canvas.LineTo(125, 10);
  Canvas.LineTo(125, 110);
  Canvas.LineTo(25, 110);

  {close the current figure. this should create a square path}
  CloseFigure(Canvas.Handle);

  {end the path bracket.  the path will now be associated with
   the device context}
  EndPath(Canvas.Handle);

  {initialize the device context's pen and brush as desired}
  Canvas.Pen.Width :=3;
  Canvas.Pen.Color := clRed;
  Canvas.Brush.Color := clLime;

  {render the path onto the device context}
  StrokeAndFillPath(Canvas.Handle);
end;

end.

⌨️ 快捷键说明

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