Y
yh
Unregistered / Unconfirmed
GUEST, unregistred user!
我想用TJPEGImage.LoadFormClipBoardFormat函数,但调用出地址错误。
unit Input;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,ActiveX,
Dialogs, DBCtrls, IBCustomDataSet, Provider, DB, DBClient, ExtCtrls,
StdCtrls, Mask, IBTable, ieview, ImageEnView, IEVect, dbimageenvect,
IEOpenSaveDlg, DBImageEn,Jpeg,ClipBrd, Menus;
type
TfrmInputCompeteProduct = class(TForm)
....
private
procedure LoadImageFromClipBoard;
public
{ Public declarations }
end;
var
frmInputCompeteProduct: TfrmInputCompeteProduct;
cf_JPEGImage:Word;
implementation
uses DataModule;
{$R *.dfm}
procedure TfrmInputCompeteProduct.LoadImageFromClipBoard;
var
jpg:tjpegimage;
MemoryStream:TMemoryStream;
bmp:TBitMap;
begin
jpg:=tjpegimage.create;
bmp:=TBitMap.Create;
MemoryStream:=TMemoryStream.Create;
try
if ClipBoard.HasFormat(CF_BitMap) then begin
bmp.Assign(ClipBoard);
jpg.Assign(bmp);
jpg.SaveToStream(MemoryStream);
ClientDataSet1.Edit;
TBlobField(ClientDataSet1.FieldByName('Picture')).LoadFromStream(MemoryStream);
ClientDataSet1.Post;
end;
if ClipBoard.HasFormat(CF_Picture) then begin
//bmp.LoadFromClipboardFormat(cf_BitMap,ClipBoard.GetAsHandle(CF_BitMap),0);//说类型不支持
jpg.LoadFromClipboardFormat(cf_JpegImage,ClipBoard.GetAsHandle(CF_JpegImage),0);//地址错误
end;
finally
jpg.free;
bmp.Free;
MemoryStream.free;
end;
ImageEnDbView1.LoadPicture;
end;
initialization
cf_JpegImage:=RegisterClipBoardFormat('Jpge Image');
TPicture.RegisterClipboardFormat(cf_JpegImage,TJpegImage);
end.
我为什么要这样做:当我用ACDSee查看JPG图形时,可以复制到ClipBoard,此时,我想粘贴到我的应用中,
就遇到了这个问题。目前是按照help做的,在DFW查看了以前的数据,但查到的都是处理的BitMap类型的数据,
所以,解决不了我的问题。
unit Input;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,ActiveX,
Dialogs, DBCtrls, IBCustomDataSet, Provider, DB, DBClient, ExtCtrls,
StdCtrls, Mask, IBTable, ieview, ImageEnView, IEVect, dbimageenvect,
IEOpenSaveDlg, DBImageEn,Jpeg,ClipBrd, Menus;
type
TfrmInputCompeteProduct = class(TForm)
....
private
procedure LoadImageFromClipBoard;
public
{ Public declarations }
end;
var
frmInputCompeteProduct: TfrmInputCompeteProduct;
cf_JPEGImage:Word;
implementation
uses DataModule;
{$R *.dfm}
procedure TfrmInputCompeteProduct.LoadImageFromClipBoard;
var
jpg:tjpegimage;
MemoryStream:TMemoryStream;
bmp:TBitMap;
begin
jpg:=tjpegimage.create;
bmp:=TBitMap.Create;
MemoryStream:=TMemoryStream.Create;
try
if ClipBoard.HasFormat(CF_BitMap) then begin
bmp.Assign(ClipBoard);
jpg.Assign(bmp);
jpg.SaveToStream(MemoryStream);
ClientDataSet1.Edit;
TBlobField(ClientDataSet1.FieldByName('Picture')).LoadFromStream(MemoryStream);
ClientDataSet1.Post;
end;
if ClipBoard.HasFormat(CF_Picture) then begin
//bmp.LoadFromClipboardFormat(cf_BitMap,ClipBoard.GetAsHandle(CF_BitMap),0);//说类型不支持
jpg.LoadFromClipboardFormat(cf_JpegImage,ClipBoard.GetAsHandle(CF_JpegImage),0);//地址错误
end;
finally
jpg.free;
bmp.Free;
MemoryStream.free;
end;
ImageEnDbView1.LoadPicture;
end;
initialization
cf_JpegImage:=RegisterClipBoardFormat('Jpge Image');
TPicture.RegisterClipboardFormat(cf_JpegImage,TJpegImage);
end.
我为什么要这样做:当我用ACDSee查看JPG图形时,可以复制到ClipBoard,此时,我想粘贴到我的应用中,
就遇到了这个问题。目前是按照help做的,在DFW查看了以前的数据,但查到的都是处理的BitMap类型的数据,
所以,解决不了我的问题。