S
sortmail
Unregistered / Unconfirmed
GUEST, unregistred user!
代码如下
TPLButtonImages = class(TPersistent)
private
FUp: TGPImage;
FPicUp:TPicture;
protected
{ Property Access Methods }
procedure SetPicUp(Value:TPicture);
public
constructor Create;overload;
destructor Destroy; override;
published
{ Property Declarations }
property Up: TGPImage read FUp ;
property PicUp:TPicture read FPicUp write SetPicUp;
end;
{ TPLButtonImages }
constructor TPLButtonImages.Create;
begin
inherited;
FUp := TGPImage.Create;
FPicUp := TPicture.Create ;
end;
destructor TPLButtonImages.Destroy;
begin
FUp.Free ;
FPicUp.Free;
inherited;
end;
procedure TPLButtonImages.SetPicUp(Value: TPicture);
var
OLS:TOLEStream;
Stream:TStream;
ISt:IStream;
begin
//如何把TPicture类的FPicUp的图片给GDI+的FUp?
FPicUp.Assign(Value);
Stream := TStream.Create ;
FPicUp.Graphic.SaveToStream(Stream); //Graphics.saveToStream是个抽象类,这里行不通,不知如何写?
OLS := TOLEStream.Create(ISt);
OLS.CopyFrom(Stream,Stream.Size );
if FUp<>nil then
FUp.Free;
FUp := TGPImage.Create(ISt);
Stream.Free ;
end;
TPLButtonImages = class(TPersistent)
private
FUp: TGPImage;
FPicUp:TPicture;
protected
{ Property Access Methods }
procedure SetPicUp(Value:TPicture);
public
constructor Create;overload;
destructor Destroy; override;
published
{ Property Declarations }
property Up: TGPImage read FUp ;
property PicUp:TPicture read FPicUp write SetPicUp;
end;
{ TPLButtonImages }
constructor TPLButtonImages.Create;
begin
inherited;
FUp := TGPImage.Create;
FPicUp := TPicture.Create ;
end;
destructor TPLButtonImages.Destroy;
begin
FUp.Free ;
FPicUp.Free;
inherited;
end;
procedure TPLButtonImages.SetPicUp(Value: TPicture);
var
OLS:TOLEStream;
Stream:TStream;
ISt:IStream;
begin
//如何把TPicture类的FPicUp的图片给GDI+的FUp?
FPicUp.Assign(Value);
Stream := TStream.Create ;
FPicUp.Graphic.SaveToStream(Stream); //Graphics.saveToStream是个抽象类,这里行不通,不知如何写?
OLS := TOLEStream.Create(ISt);
OLS.CopyFrom(Stream,Stream.Size );
if FUp<>nil then
FUp.Free;
FUp := TGPImage.Create(ISt);
Stream.Free ;
end;