
25.04.2009, 16:25
|
Прохожий
|
|
Регистрация: 25.04.2009
Сообщения: 6
Репутация: 10
|
|
что я делаю не так?
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
PaintBox1: TPaintBox;
procedure FormCreate(Sender: TObject);
private
procedure DrawBitmap(const Filename: String; const x,y: Integer);
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.DrawBitmap(const Filename: String; const x,y: Integer);
var
Bmp: TBitmap;
begin
// Проверяем наличие картинки
if not FileExists(Filename) then
begin
ShowMessage('The bitmap ' + Filename + ' was not found!');
Exit;
end;
Bmp := TBitmap.Create;
Bmp.LoadFromFile(Filename);
PaintBox1.Canvas.Draw(x, y, Bmp);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
DrawBitmap('test.bmp', 100, 100);
end;
end.
|