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

📄 widenpathu.pas

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

interface

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

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);
begin
  {begin a path bracket}
  BeginPath(Canvas.Handle);

  {set the background mode to TRANSPARENT so that the path will be defined as
   the area inside of the text}
  SetBkMode(Canvas.Handle, TRANSPARENT);

  {draw some text. note that the form's font is set to size 48 Arial, bold}
  TextOut(Canvas.Handle, 20, 20, 'Delphi Rocks!', Length('Delphi Rocks!'));

  {end the path bracket}
  EndPath(Canvas.Handle);;

  {modify the pen so that it is 4 pixels wide}
  Canvas.Pen.Width := 4;

  {widen the path defined by the text. due to the pen width, above, the new
   path is a 4 pixel wide outline of the letters}
  WidenPath(Canvas.Handle);

  {reset the pen width and brush color for drawing the path}
  Canvas.Pen.Width := 1;
  Canvas.Brush.Color := clRed;

  {set the fill mode so that the path will be drawn correctly}
  SetPolyFillMode(Canvas.Handle, WINDING);

  {fill the path with the red brush}
  FillPath(Canvas.Handle);
end;

end.

⌨️ 快捷键说明

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