RadScrollablePanel Scrollbar issues

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

    Posted 15 Jan Link to this post

    Hello there,
    I have some question about working with RadScrollablePanel.

    Sometimes the RadScrollablePanel does not correctly display the scrollbars. For example, I use RadLabel bounded by width of RadScrollablePanel (using the dynamically changeable MaximumSize property). 
    I noticed that the vertical scrollbar does not always appear if the height of RadLabel and height of RadScrollablePanel.DisplayRectangle differ by about 10 pixels (at 96 DPI and Segoe UI 8.25pt font). This is clearly seen in example 1.
    If we change width of RadScrollablePanel by a few pixels, we will see a different picture. A vertical scrollbar will be displayed on the screen and everything will look like it’s supposed to be. Keep in mind that the height of the elements remains unchanged. This is seen in example 2.
    But that's not all. If we change the RadForm size a little more again, then we will see that the vertical scrollbar disappeared from the screen again; however, it's marked as Visible = True and if we take the focus on RadScrollablePanel, we can scroll the content using mouse wheel for example. This is seen in example 3.

    Example 1: https://c2n.me/3ZabLEg
    Example 2: https://c2n.me/3Zaclrf
    Example 3: https://c2n.me/3ZacJol

    At first sight, this may seem like a minor bug. However, considering that RadForms (or another container) with a fixed size can be used, and the text itself can change dynamically during operation, this bug causes problems with displaying information for users.
    What guidelines can you give to work with RadScrollablePanel to prevent this bug?
    Below I attach project with example. Please change extension from JPG to ZIP. 

    I use Telerik 2018.3.1016.20 with .Net 3.5 on Win7

    Best regards. 

  2. Hristo
    Admin
    Hristo avatar
    1504 posts

    Posted 16 Jan Link to this post

    Hi Jeremy,

    The scrollable panel internally uses a container which is a System.Windows.Forms.Panel and our scrollbars are synced with the scrollbars of the panel. You can achieve the desired behavior by changing the AutoScrollMargin property of the standard panel: 
    this.radScrollablePanel1.AutoScrollMargin = new Size(1, 1);

    I hope this will help. Let me know if you need further assistance.

    Regards,
    Hristo
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Jeremy
    Jeremy avatar
    12 posts
    Member since:
    Dec 2013

    Posted 24 Jan in reply to Hristo Link to this post

    Hello there, I spent some time trying your solution and finally found working one.

    radScrollablePanel1.AutoScrollMargin = new Size(radScrollablePanel1.VerticalScrollbar.Size.Width, radScrollablePanel1.HorizontalScrollbar.Size.Height);

    If AutoScrollMargin  is 1,1  or any other size except exact size of ScrollBar (or multiply of it) I see same issues as before and even more on High DPI. I attach project without the fix with AutoScrollMargin  = 1,1.

    First issue

    If you click on label on 100% DPI, you will see the issue, I believe it yours, not Microsoft's. Form will shrink, you will be able to scroll txt with mouse, scrollbar will have Visible=true, but won't be actually displayed. 

    First issue happens when height is constant, width is big enough to avoid scrolling, and then you step by step reducing ONLY  width with small steps (5px).

    Second issue

    On HDPI the project will finally hang in cyclic resize events. 

    Hanging happens when scrollbar need to be shown or hidden, so you need to jump over that critical size in both directions.

    Third issue

    Also on HDPI scrollbar will be show only when two lines of text are hidden, if only one line of text is hidden - scrollbar not shown. 

    For reproduce you need to set size big enough to avoid scrollbars, and start reducing height with small steps. 

    Solution 

    If I set AutoScrollMargin to size of scrollbar or 2x, 3x of it, it will work almost perfect. If it is at least one pixel bigger or smaller - all issues comes back, just in different size. 

    I fell like it can be big issue overall, since it uses some basic code for calculating sizes, and can be used as internal component of other controls. I tried to subscribe to all possible resize events of ScrollablePanel and ScrollablePanelContainter, it doesn't solve issues. So at the moment the problem has workaround, but please consider some more time in deeper looking into it. 

  4. Hristo
    Admin
    Hristo avatar
    1504 posts

    Posted 25 Jan Link to this post

    Hello Jeremy,

    Thank you for the update. I am glad that you have managed to find a suitable solution. I will also share your input with the rest of the team. It might be hard to actually find a clean solution as we are relying on the standard scrollbars. Yet if we manage to find one, I will update the thread.

    Regards,
    Hristo
    Progress Telerik
    Get quickly onboarded 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