Dynamically size Chart

3 posts, 0 answers
  1. Ryan farquhar
    Ryan farquhar avatar
    4 posts
    Member since:
    Jul 2007

    Posted 20 Jun 2007 Link to this post

    I have the Radchart placed inside a DockWindow. What I would like to do is have the chart auto-size to the size of the DockWindow, so when someone maximizes the application the chart gets resized with the DockWindow.

    So I either need a function I can call that automatically sizes it or some way of getting the size of the DockWindow that it is inside.

    Any help would be appreciated.
  2. Ryan farquhar
    Ryan farquhar avatar
    4 posts
    Member since:
    Jul 2007

    Posted 20 Jun 2007 Link to this post

    Nevermind, got it. To dynamically resize the chart to the same size as the dockpanel, you just add the following to the dockingmanger resize function:

    RadChart1.Height = DockPanel2.Height
    RadChart1.Width = DockPanel2.Width

    This works great. I also added that code to the Load Sub so it would size correctly when the app starts.

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Dwight
    Admin
    Dwight avatar
    475 posts

    Posted 21 Jun 2007 Link to this post

    Hi Alicia,

    I'm glad that you found your way though the problem.

    Another solution I may suggest is using the code you already wrote in the Load method to resize the chart, and then anchoring it. This way the framework will resize the chart for you when needed and you won't need the code in the Resize method.

    The code for the Load method is something like:
     
    radChart1.Size = DockPanel2.Size; 
    radChart1.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; 
     

     
    Best wishes,
    Evtim
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top