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

📄 ugetpolyfillmode.pas

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

interface

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

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

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormPaint(Sender: TObject);
var
  PointsArray: Array[0..10] of TPoint;  // holds the polygon definition
  FillMode: Integer;                    // holds the fill mode
begin
  {define the polygon}
  PointsArray[0].X := 145;
  PointsArray[0].Y := 220;
  PointsArray[1].X := 145;
  PointsArray[1].Y := 20;
  PointsArray[2].X := 310;
  PointsArray[2].Y := 20;
  PointsArray[3].X := 310;
  PointsArray[3].Y := 135;
  PointsArray[4].X := 105;
  PointsArray[4].Y := 135;
  PointsArray[5].X := 105;
  PointsArray[5].Y := 105;
  PointsArray[6].X := 280;
  PointsArray[6].Y := 105;
  PointsArray[7].X := 280;
  PointsArray[7].Y := 50;
  PointsArray[8].X := 175;
  PointsArray[8].Y := 50;
  PointsArray[9].X := 175;
  PointsArray[9].Y := 220;

  {set the polygon fill mode to the selected value}
  if RadioGroup1.ItemIndex = 0 then
    SetPolyFillMode(Canvas.Handle, ALTERNATE)
  else
    SetPolyFillMode(Canvas.Handle, WINDING);

  {display the device context's polygon fill mode}
  FillMode := GetPolyFillMode(Canvas.Handle);
  if FillMode = Alternate then
    Caption := 'GetPolyFillMode Example - Alternate'
  else
    Caption := 'GetPolyFillMode Example - Winding';

  {set the brush to red and draw a filled polygon}
  Canvas.Brush.Color := clRed;
  Polygon(Canvas.Handle, PointsArray, 10);
end;

procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
  {repaint the form when a new selection is made}
  Repaint;
end;

end.

⌨️ 快捷键说明

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