将BMP放入DBASE和Paradox的BLOB字段中
(1)使用裁剪板
procedure TForm1.Button1Click(Sender: TObject);
var
C: TClipboard;
begin
C := TClipboard.Create;
try
if Clipboard.HasFormat(CF_BITMAP) then
DBImage1.PasteFromClipboard
else
ShowMessage('Clipboard does not contain a bitmap!');
finally
C.Free;
end;
end;
(2)从文件调入
procedure TForm1.Button2Click(Sender: TObject);
begin
Table1Bitmap.LoadFromFile(
'c:/delphi/images/splash/16color/construc.bmp');
end;
(3)从其他控件的BITMAP类中读入
procedure TForm1.Button3Click(Sender: TObject);
var
B: TBitmap;
begin
B := TBitmap.Create;
try
B.LoadFromFile(
'c:/delphi/images/splash/16color/athena.bmp');
DBImage1.Picture.Assign(B);
finally
B.Free;
end;
end;
显示BLOB字段的BMP图
(1)直接显示当前记录
procedure TForm1.Button1Click(Sender: TObject);
begin
Image1.Picture.Bitmap.Assign(Table1Bitmap);
//Table1Bitmap为在Table中添加的字段
end;
(2)直接显示
procedure TForm1.Button1Click(Sender: TObject);
begin
Image1.Picture.Bitmap.Assign(
TBLOBField(Table1.Fields[1]));
end;
//Image1.Picture.Bitmap.Assign(Table1.Fields[1]);也行
(3)不直接显示
procedure TForm1.Button2Click(Sender: TObject);
var
B: TBitmap;
begin
B := TBitmap.Create;
try
B.Assign(Table1Bitmap);
Image1.Picture.Bitmap.Assign(B);
finally
B.Free;
end;
end;