老提示未声明变量?
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
Image1: TImage;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
procedure TForm1.draw_bitmap;
var
bitmap:Tbitmap;
begin
bitmap:=Tbitmap.Create ;
bitmap.LoadFromFile('aa.jpg');
with image1.picture.bitmap do
begin
width:=bitmap.width;
height:=bitmap.height;
palette:=bitmap.palette;
canvas.draw(0,0,bitmap);
refresh;
end;
canvas.draw(0,0,bitmap);
selectpalette(form1.Canvas.Handle,bitmap.Palette.true);
realizepalette(form1.canvas.handle);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
draw_bitmap;
end;
end.
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
Image1: TImage;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
procedure TForm1.draw_bitmap;
var
bitmap:Tbitmap;
begin
bitmap:=Tbitmap.Create ;
bitmap.LoadFromFile('aa.jpg');
with image1.picture.bitmap do
begin
width:=bitmap.width;
height:=bitmap.height;
palette:=bitmap.palette;
canvas.draw(0,0,bitmap);
refresh;
end;
canvas.draw(0,0,bitmap);
selectpalette(form1.Canvas.Handle,bitmap.Palette.true);
realizepalette(form1.canvas.handle);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
draw_bitmap;
end;
end.
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
Image1: TImage;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
procedure draw_bitmap;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
procedure TForm1.draw_bitmap;
var
bitmap:Tbitmap;
begin
bitmap:=Tbitmap.Create ;
bitmap.LoadFromFile('aa.jpg');
with image1.picture.bitmap do
begin
width:=bitmap.width;
height:=bitmap.height;
palette:=bitmap.palette;
canvas.draw(0,0,bitmap);
refresh;
end;
canvas.draw(0,0,bitmap);
selectpalette(form1.Canvas.Handle,bitmap.Palette.true);
realizepalette(form1.canvas.handle);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
draw_bitmap;
end;
end.