locked
I have a form in which i am adding usercontrol,but when i resize form The main form elements resizes but usercontrol elements does not resizes.I have given all itemes as percentage RRS feed

  • Question

  • I  have a  form  in  which i  am  adding  usercontrol,but  when i resize  form The  main  form  elements  resizes  but  usercontrol elements  does  not  resizes.I  have  given  all  itemes as  percentage
    Wednesday, January 3, 2018 7:23 AM

All replies

  • Hello!

    Did you set Dock = DockStyle.Fill for the user control?

    > I  have  given  all  itemes as  percentage

    Are you meaning that some controls were placed on the TableLayoutPanel, right? If so, you can try to set DockStyle.Fill  for the panel

    Wednesday, January 3, 2018 7:44 AM
  • Hi Vivek,

    In addition to Dock property, you can also consider Anchor property, check Bottom, Top Left, Right.

    Anchor refers to the position a control has relative to the edges of the form. A textbox, for example, that is anchored to the left edge of a form will stay in the same position as the form is resized.

    Docking refers to how much space you want the control to take up on the form. If you dock a control to the left of the form, it will stretch itself to the height of the form, but its width will stay the same.

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Stanly Fan Friday, January 12, 2018 6:02 AM
    Wednesday, January 3, 2018 8:16 AM
  • Hi,

    This is my sample (VB.NET), not perfect, but I hope it would be helpful.
    If you are using C#, please say it.


    I've shared this project via OneDrive. Please download and check it (FlexForm_VB.zip).

    Regards,

    Ashidacchi

    • Proposed as answer by Stanly Fan Friday, January 5, 2018 7:18 AM
    Wednesday, January 3, 2018 10:39 AM