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

📄 unitfrmmain.pas

📁 《Delphi百例》源码?禗elphi百例》源码
💻 PAS
字号:
unit unitFrmMain;

interface

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

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

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
  newbmp: TBitmap;
  i, bmpheight, bmpwidth: integer;
begin
  newbmp := TBitmap.Create;
  newbmp.Width := image1.Width;
  newbmp.Height := image1.Height;
  bmpheight := image1.Height;
  bmpwidth := image1.Width;
  for i := 0 to bmpheight do
    begin
      newbmp.Canvas.CopyRect(Rect
        (0, bmpheight - i, bmpwidth, bmpheight),
        image1.Canvas,
        Rect(0, 0, bmpwidth, i));
      form1.Canvas.Draw(120, 100, newbmp);
    end;
  newbmp.free;
end;

procedure TForm1.Button2Click(Sender: TObject);

var
  newbmp: TBitmap;
  i, j, bmpheight, bmpwidth: integer;
begin
  newbmp := TBitmap.Create;
  newbmp.Width := image1.Width;
  newbmp.Height := image1.Height;
  bmpheight := image1.Height;
  bmpwidth := image1.Width;
  i := 0;
  while i <= bmpheight do
    begin
      j := i;
      while j > 0 do
        begin
          newbmp.Canvas.CopyRect(Rect(0, j - 1, bmpwidth, j),
            image1.Canvas,
            Rect(0, bmpheight - i + j - 1, bmpwidth, bmpheight - i + j));
          newbmp.Canvas.CopyRect(Rect
            (0, bmpheight - j, bmpwidth, bmpheight - j + 1),
            image1.Canvas,
            Rect(0, i - j, bmpwidth, i - j + 1));
          j := j - 2;
        end;
      form1.Canvas.Draw(120, 100, newbmp);
      i := i + 2;
    end;
  newbmp.free;
end;
end.

⌨️ 快捷键说明

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