Shape的应用

来源:互联网 发布:ipad1软件下载 编辑:程序博客网 时间:2024/06/07 00:17


unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    ColorDialog1: TColorDialog;
    Shape1: TShape;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    BitBtn1: TBitBtn;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  Shape1.Shape := stRectangle;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Shape1.Shape := stRoundRect;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  Shape1.Shape := stEllipse;
end;

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
  try
  if ColorDialog1.Execute then
    Shape1.Brush.Color := ColorDialog1.Color;
  except
    ShowMessage('颜色面板无法开启');
  end;
end;

end.

原创粉丝点击