T
true_feiyun
Unregistered / Unconfirmed
GUEST, unregistred user!
unit U1_424;
interface
uses
Windows, Messages, SysUtils, Variants, 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);
const
step=200;
x0=0;
y0=0;
var
bitmap:tbitmap;
midx:integer;
ratiox:real;
i:integer;
rect1,rect2:trect;
begin
bitmap:=tbitmap.Create;
bitmap.LoadFromFile('1.bmp');
ratiox:=bitmap.Width/step;
for i:=0 to step do
begin
midx:=round(ratiox*i);
with rect1 do
begin
left:=bitmap.Width-midx;
top:=0;
right:=bitmap.Width;
bottom:=bitmap.Height;
end;
with rect2 do
begin
left:=x0;
top:=y0;
right:=x0+midx;
bottom:=y0+bitmap.height;
end;
canvas.CopyRect(rect2,bitmap.Canvas,rect1);
end;
bitmap.Free;
end;
end.
以上代码把一副图象从左向右显示,请问如何修改代码,
让图象从右向左,从上到下,从下到上显示呢(用copyrect的方法)
interface
uses
Windows, Messages, SysUtils, Variants, 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);
const
step=200;
x0=0;
y0=0;
var
bitmap:tbitmap;
midx:integer;
ratiox:real;
i:integer;
rect1,rect2:trect;
begin
bitmap:=tbitmap.Create;
bitmap.LoadFromFile('1.bmp');
ratiox:=bitmap.Width/step;
for i:=0 to step do
begin
midx:=round(ratiox*i);
with rect1 do
begin
left:=bitmap.Width-midx;
top:=0;
right:=bitmap.Width;
bottom:=bitmap.Height;
end;
with rect2 do
begin
left:=x0;
top:=y0;
right:=x0+midx;
bottom:=y0+bitmap.height;
end;
canvas.CopyRect(rect2,bitmap.Canvas,rect1);
end;
bitmap.Free;
end;
end.
以上代码把一副图象从左向右显示,请问如何修改代码,
让图象从右向左,从上到下,从下到上显示呢(用copyrect的方法)