This is a migrated thread and some comments may be shown as answers.

Size of QRCode doesn't match Width & Height set on control

5 Answers 381 Views
BarCode
This is a migrated thread and some comments may be shown as answers.
Alan
Top achievements
Rank 1
Alan asked on 01 Aug 2013, 09:01 PM
I want the QRCode size to match the Width & Height I specify on the control, but this doesn't work.
The size of the QRCode seems to be limited by Width & Height, but only changes when I set the Version differently.

I have tried to set the content alignment to Stretch also to no effect.

Can you please tell me how to do this?

Thanks,
 Alan

5 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 02 Aug 2013, 07:56 AM
Hi,

Indeed, the control behaves like this.
The reason for this is two-fold.
First, there is a 4-module wide whitespace around the QR-code, which is calculated as width of the control itself.
Second, when calculating the size of each module, this may result in losing a couple of pixels from the original width, because of width/modules count division.
I hope this information helps.

Regards,
Yavor
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Alan
Top achievements
Rank 1
answered on 02 Aug 2013, 05:41 PM
Yavor,

Thanks for the reply, but I still would like to know how I could get the QRCode to rendering exactly to a desired Width & Height given a particular Version specified.

I want the QRCode to fit the Width & Height I specified to fill out the space I have for it.

Can you suggest some potential solutions?

Thanks,
 Alan
0
Yavor
Telerik team
answered on 06 Aug 2013, 12:27 PM
Hi,

Although it does sound unintuitive, due to the way the control is created and rendered, there is no intuitive way to handle this. You can set width dimension for the control, but it will be rendered respecting both the width and the modules which it needs to render.
I hope this information helps.

Regards,
Yavor
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
René
Top achievements
Rank 1
answered on 21 Sep 2016, 12:29 PM

Hi Yavor,

we have the same problem in our company with the WPF-RadBarcodeQR. Is this bug already fixed? Or can you suggest any workaround?

Setting negative values like in your samples is not an option because the acutual size depends on the content of the QRcode (and other parameters). Our customer demands to have a fixed gap between the barcode and other controls.

Any way to achieve this with Telerik?

 

Thanks in advance

Rene

0
Martin Ivanov
Telerik team
answered on 26 Sep 2016, 07:57 AM
Hello Rene,

The behavior described by Alan is not a bug in the control, but an expected behavior implemented because of the QR code specification. You can take a look at the Visual Structure help article of the QR.

Note that removing the quite zone (the blank spaces around the barcode) could be an issue when you try to scan the printed code. However, if you want to remove it you can try to wrap the RadBarcodeQR control into a content presenter with smaller size then the QR itself. This will clip the control and the white spaces won't be visible.
<Border Width="212" Height="212">
    <telerik:RadBarcodeQR Text="Some text"
                          Width="300"
                          Height="300"
                          HorizontalAlignment="Center"
                          VerticalAlignment="Center" />
</Border>

Regards,
Martin
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
BarCode
Asked by
Alan
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Alan
Top achievements
Rank 1
René
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or