How to prevent scroll bars for a treeview in an automated manner?

38 posts, 2 answers
  1. Sunil
    Sunil avatar
    230 posts
    Member since:
    Jan 2004

    Posted 12 Dec 2010 Link to this post

    Hi Richard,

    I have some questions after reading your code.
    1. Before you get maxright and maxbottom, you are getting all nodes in  a single LIST<>. Right? That means  all children, grandchildren etc are in the same flat List<>.
    2. What is the purpose of adding a 2 before returning a value from GetMaxRigth or GetMaxBottom methods?
    What I had done in my approach, was use your initial approach, but modified it so the number of iterations is minimized. I executed your initial code with a step value of 100, so I would be within 100 pixels more than the optimal width. I then executed your code again but with a step of 5., so I am within 5 pixels more than optimum width. This way I would end up with very few iterations. May be 4 or 5 iterations as opposed to 200 or 400 iterations that I would end up with if using a step of 1.
    Thanks
    Sunil
  2. Sunil
    Sunil avatar
    230 posts
    Member since:
    Jan 2004

    Posted 12 Dec 2010 Link to this post

    Hi Richard,

    I tried your approach where you add a 2 always to maxRight or maxBottom, but it gives me scroll bars.
    The performance is definitely better, but somewhere we are missing the exact number that needs to be added as extra to a Right or Bottom of a node.
    BOMRadTree Resizing Performance with your New Approach

    Thanks
    Sunil
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 12 Dec 2010 Link to this post

    Hi Sunil,

    I think we are getting into a differences now between version as the SetSize method always sets the scrollbars visibility to false.
    Yes, I am getting a flattened list of nodes, but only adding in the ones that are expanded so cutting down on the ones that need to be inspected.

    The purpose of always adding 2 onto the end was just for a little padding so it wasn't squashed. But the value without the 2 padding would have been fine.

    With my final approach, it always finds the correct size (in the latest version of RadTreeView) and doesn't show scrollbars at any level. Have you tried the newest version of the code I posted yet?

    Hope that helps
    Richard
  5. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 12 Dec 2010 Link to this post

    Sunil,

    Also remember on mine you may need to change Bounds to LabelBounds for your older RadControls version.
    Richard
  6. Sunil
    Sunil avatar
    230 posts
    Member since:
    Jan 2004

    Posted 12 Dec 2010 Link to this post

    Hi Richard,
    I will try using LabelBounds in the version I am using.
    Your initial approach combined with the modifications for fewer iterations that I added, was very sound and would work in all versions, it seems.

    Thanks
    Sunil
  7. Sunil
    Sunil avatar
    230 posts
    Member since:
    Jan 2004

    Posted 12 Dec 2010 Link to this post

    Hi Richard,

    I tried your approach using LabelBounds instead of Bounds but still I get scrollbars as posted in an earlier post.

    Thanks
    Sunil

  8. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 12 Dec 2010 Link to this post

    Hi Sunil,

    It looks like now any further attempts for me to modify this aren't going to be as good as the version that you now have. Probably due to the fact that we are using different versions of the controls. I'm glad though that I could help and hope that you've found this useful. I'd only ask that you mark the posts that you found most useful as answer.

    If you have any further questions though, do just let me know.
    All the best
    Speak soon
    Richard
  9. Sunil
    Sunil avatar
    230 posts
    Member since:
    Jan 2004

    Posted 12 Dec 2010 Link to this post

    Hi Richard,

    Yes I agree with you.
    I appreciate all your help in getting this problem solved.
    In my version of Q1 2008 SP1, the approach that works is  your first approach ( first marked answer) combined with the modifications I made for drastically decreasing the number of iterations. Look for  'VanishHorizonatalScroll(bomRadTreeView, 100);' to see the post that outlines this approach.

    Thanks a  lot
    Sunil
                 
Back to Top
UI for WinForms is Visual Studio 2017 Ready