TelerikDpiHelper.ScaleSize returns negative values

2 posts, 1 answers
  1. Jeremy
    Jeremy avatar
    12 posts
    Member since:
    Dec 2013

    Posted 24 Jan Link to this post

    Hello there. 

    This code returns negative MaxSize on 100% dpi, since it overflows int.

    var dpiScaleFactor = radLabel1.RootElement.DpiScaleFactor;
    var r1 = new Size(150, int.MaxValue);
    var r2 = TelerikDpiHelper.ScaleSize(r1, new SizeF(1f / dpiScaleFactor.Width, 1f / dpiScaleFactor.Height));

    I use that code to descale some sizes on runtime per suggestion on the forum, also I have seen similar code in Telerik sources. When control receives negative max size it becomes invisible. You may want to investigate this cases. 

    I use Telerik 2018.3.1016.20 with .Net 3.5 on Server 2008 R2 SP1.

    Best regards.

  2. Answer
    Dimitar
    Admin
    Dimitar avatar
    2790 posts

    Posted 25 Jan Link to this post

    Hello Jeremy,

    Thank you for reporting this. We will consider your feedback. 

    Please note that it is not common to use Int.MaxValue for size, if you do not want to set maximum height just use 0 instead.

    Should you have any other questions do not hesitate to ask.

    Regards,
    Dimitar
    Progress Telerik
    Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top