Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TIWImage
#3
The drawing is not displayed. Can you tell me what the problem is?

procedure TfmShowQRC.IWAppFormShow(Sender: TObject);
var
mStream1 : TMemoryStream;
mStream2 : TMemoryStream;
mPng : TPngobject;
mPicture : TPicture;
mBmp : TBitMap;
begin
mStream1 := TMemoryStream.Create;
mStream2 := TMemoryStream.Create;
mPng := TPNGObject.Create;
mBmp := TBitmap.Create;
try
mQRC := TestPictureBase64;
mStream1.WriteBuffer(mQRC[1],Length(mQRC)*SizeOf(Char));
mStream1.Position:=0;
DecodeStream(mStream1,mStream2);
mStream2.Position := 0;
mPng.LoadFromStream(mStream2);
mBmp.Canvas.Draw(0,0,mPng);
IWImage.Picture.Bitmap := mBmp;
finally
FreeAndNil(mStream1);
FreeAndNil(mStream2);
FreeAndNil(mPng);
FreeAndNil(mBmp);
end;
end;

And here is a working code for VCL:
procedure TfmViewQRC.FormShow(Sender: TObject);
var
mStream1 : TMemoryStream;
mStream2 : TMemoryStream;
mPng : TPngobject;
mBmp : TBitmap;
begin
mContent := TestPictureBase64;
mStream1 := TMemoryStream.Create;
mStream2 := TMemoryStream.Create;
mPng := TPNGObject.Create;
try
mStream1.WriteBuffer(mContent[1],Length(mContent)*SizeOf(Char));
mStream1.Position:=0;
DecodeStream(mStream1,mStream2);
mStream2.Position := 0;
mPng.LoadFromStream(mStream2);
Image1.Canvas.Draw(0,0,mPng);
finally
mStream1.Destroy;
mStream2.Destroy;
mPng.Destroy;
end;
end;
Reply


Messages In This Thread
RE: TIWImage - by Alexandre Machado - 05-27-2022, 01:55 AM
RE: TIWImage - by Сергей Александрович - 05-27-2022, 04:29 AM
RE: TIWImage - by Alexandre Machado - 05-27-2022, 09:40 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)