closefigureu.pas
来自「Delphi Win32核心API参考光盘源码 本书包含了常用的Windows」· PAS 代码 · 共 68 行
PAS
68 行
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 + =
减小字号Ctrl + -
显示快捷键?