HI,
I am generating a Qrcode via an API, which returns the Qrcode as a BMP file. This file a insert into a Scalerichview as per the function given below. After inserting, the this image is seen as a dot. I am able to click this image and change the properties. After that is image is show correctly. I am using this in an editor. Ataching the properties image for reference. I understand this has something to do with the style may be.
The following is the function
procedure TTextEditorNewForm.InsertQrCode(cCertId:String);
var mStream : TMemoryStream;
bmp : TBitmap;
begin
mstream := TMemoryStream.Create;
try
IdHttp2.Get('http://172.16.15.10:5002/getcertificate/'+ cCertId,mstream);
mstream.Position := 0;
AdvPicture1.Picture.LoadFromStream(mstream);
AdvPicture1.Picture.SaveToFile(ExtractFilePath(Application.ExeName)+'certid.bmp');
finally
FreeAndNil(Mstream);
end;
bmp := TBitmap.Create;
bmp.LoadFromFile(ExtractFilePath(Application.ExeName)+'certid.bmp');
with TextEdit.RichViewEdit do begin
//AddTextNL(' ',rvsKeyword,0,0);
AddTextNL(' ',rvsNormal,0,0);
AddPicture('', bmp, -1);
SetItemExtraIntProperty(ItemCount - 1, rvepImageHeight, 30);
SetItemExtraIntProperty(ItemCount - 1, rvepImageWidth , 30);
//AddTextNL(' ',rvsKeyword,0,0);
AddTextNL(' ',rvsNormal,0,0);
Format;
end;
end;
Kindly help.
Thanks in advance
QrCode Inserted as bmp
QrCode Inserted as bmp
- Attachments
-
- Image1.jpg (209.82 KiB) Viewed 54464 times
-
- image-1.jpg (201.63 KiB) Viewed 54464 times
-
- Site Admin
- Posts: 17520
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: QrCode Inserted as bmp
Obviously, it happens because not pixels, but twips or EMU are used as measure units, so 30 is a too small size.
Change the resizing code to:
Change the resizing code to:
Code: Select all
SetItemExtraIntProperty(ItemCount - 1, rvepImageHeight, Style.StandardPixelsToUnits(30));
SetItemExtraIntProperty(ItemCount - 1, rvepImageWidth , Style.StandardPixelsToUnits(30));
Re: QrCode Inserted as bmp
Problem solved.
Thanks
Regards,
Thanks
Regards,
-
- Site Admin
- Posts: 17520
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: QrCode Inserted as bmp
By the way, is smooth scaling OK for these QrCodes? Maybe I should add a property to an image item to disable smooth scaling?