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

6 posts, 0 answers
  1. Alan
    Alan avatar
    25 posts
    Member since:
    Jan 2013

    Posted 01 Aug 2013 Link to this post

    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
  2. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 02 Aug 2013 Link to this post

    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Alan
    Alan avatar
    25 posts
    Member since:
    Jan 2013

    Posted 02 Aug 2013 Link to this post

    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
  5. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 06 Aug 2013 Link to this post

    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 >>
  6. René
    René avatar
    2 posts
    Member since:
    Jun 2016

    Posted 21 Sep Link to this post

    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

  7. Martin
    Admin
    Martin avatar
    1101 posts

    Posted 26 Sep Link to this post

    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.
Back to Top
UI for WPF is Visual Studio 2017 Ready