usercontrol resizing dock anchoring parent vb.net

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • marfi95

    #1

    usercontrol resizing dock anchoring parent vb.net

    My application consists of basically a treeview on the left side,
    along with a panel control that takes up the right side. When nodes
    are clicked on the left, the data on the right side of the panel is
    changed based on that type.

    What I'm using are usercontrols, so I can do the visual design of them
    in a separate window. when the node is clicked, I assign the parent
    of the usercontrol to the panel control that is on the right side of
    the window. this is all working great except for a small problem. I
    can't get the usercontrol to respect the docking/anchoring properties
    so that when the screen is maximized the controls on the usercontrol
    get adjusted automatically.

    The main control on each usercontrol is a panel that is set to Dock-
    Fill. All other controls are placed within this panel accordingly
    with Top,Left anchoring. I thought that was all I had to do so that
    the panel got filled, but I guess the usercontrol panel is only
    filling to the size of the usercontrol.

    How do i get the usercontrol to resize (and all of its controls) based
    on the size of its parent (which is the panel on the main form).

    Hope that made sense.

    Thanks !
    Mark

  • Spam Catcher

    #2
    Re: usercontrol resizing dock anchoring parent vb.net

    "marfi95" <marfi95@gmail. comwrote in news:1171583248 .106291.257160
    @s48g2000cws.go oglegroups.com:
    The main control on each usercontrol is a panel that is set to Dock-
    Fill. All other controls are placed within this panel accordingly
    with Top,Left anchoring. I thought that was all I had to do so that
    the panel got filled, but I guess the usercontrol panel is only
    filling to the size of the usercontrol.
    Did you dock or anchor the user control itself to the parent form?

    Also each control within the user control/panel needs to be anchored
    properly as well.

    How do i get the usercontrol to resize (and all of its controls) based
    on the size of its parent (which is the panel on the main form).

    Comment

    • Phill W.

      #3
      Re: usercontrol resizing dock anchoring parent vb.net

      marfi95 wrote:
      My application consists of basically a treeview on the left side,
      along with a panel control that takes up the right side. When nodes
      are clicked on the left, the data on the right side of the panel is
      changed based on that type.
      when the node is clicked, I assign the parent of the usercontrol to the
      panel control that is on the right side of the window.
      I'd expect to see something more like

      RightPanel.Cont rols.Add( userControl )

      but they /probably/ do much the same things, under the covers.
      How do i get the usercontrol to resize (and all of its controls) based
      on the size of its parent (which is the panel on the main form).
      Follow the above with

      ' You'll need this if SuspendLayout has been called
      userControl.Siz e = Rightpanel.Clie ntSize

      ' Get the UserControl to fill the panel
      userControl.Doc k = DockStyle.Fill

      HTH,
      Phill W.

      Comment

      • marfi95

        #4
        Re: usercontrol resizing dock anchoring parent vb.net

        On Feb 16, 6:45 am, "Phill W." <p-.-a-.-w-a-r...@-o-p-e-n-.-a-c-.-u-k>
        wrote:
        marfi95 wrote:
        My application consists of basically a treeview on the left side,
        along with a panel control that takes up the right side. When nodes
        are clicked on the left, the data on the right side of the panel is
        changed based on that type.
        when the node is clicked, I assign theparentof theusercontrolt o the
        panel control that is on the right side of the window.
        >
        I'd expect to see something more like
        >
        RightPanel.Cont rols.Add(userCo ntrol)
        >
        but they /probably/ do much the same things, under the covers.
        >
        How do i get theusercontrolt oresize(and all of its controls) based
        on the size of itsparent(which is the panel on the main form).
        >
        Follow the above with
        >
        ' You'll need this if SuspendLayout has been calleduserContr ol.Size = Rightpanel.Clie ntSize
        >
        ' Get theUserControlt o fill the paneluserContro l.Dock = DockStyle.Fill
        >
        HTH,
        Phill W.
        Didn't seem to help. This is basically the code in the main form when
        the treenode is selected

        userControlList (i).Visible = True
        userControlList (i).Parent = Me.pnlBottomRig ht
        userControlList (i).size = pnlBottomRight. Size
        userControlList (i).dock = DockStyle.Fill
        userControlList (i).PopulateDat a()


        Comment

        Working...