Windows Develop Bookmark and Share   
 index > Windows Forms General > Can't get flowLayoutPanel to show usercontrol properly.
 

Can't get flowLayoutPanel to show usercontrol properly.

Hello,


I have a FlowLayoutPanel on the Form. I am trying to put User Control Dynamically on this page. But some for reason following things are happening.


1> First User control is chopped on the left side.
2>Spacing between user controls are very very less.
3>User control is shown much bigger than it should be.


i have tried setting Margin, AutoSize, Padding, Anchor but nothing is workin.


Please help.


Nadeem Alvi  Thursday, October 18, 2007 7:21 PM

Hi Alvi,

FlowLayoutPanel is designed to arrange controls as a linear collection and support wrapping. Its contents can be wrapped from one row to the next or from one column to the next.

1) You can set the FlowDirection Property to indicate the flow direction of the FlowLayoutPanel control. For example, you can set the FlowDirection to RightToLeft to make the elements flow from the right edge to the left.

2) There is no property which you can set to control the space between FlowLayoutPanel’s child controls. But you can add a panel between the FlowLayoutPanel’s child controls to increase the ‘space�

3) I think this is because that your UserControl has a large size, you can try to set the size of your UserControl to solve this problem.

Code Block

myUserControl.Height = 50;

usUrControl.Width = 50;

Also, you can set the Padding to specify the interior space of the FlowLayoutPanel.

Hope this helps.
Best regards.
Rong-Chun Zhang

Rong-Chun Zhang  Tuesday, October 23, 2007 7:11 AM

Hi Alvi,

FlowLayoutPanel is designed to arrange controls as a linear collection and support wrapping. Its contents can be wrapped from one row to the next or from one column to the next.

1) You can set the FlowDirection Property to indicate the flow direction of the FlowLayoutPanel control. For example, you can set the FlowDirection to RightToLeft to make the elements flow from the right edge to the left.

2) There is no property which you can set to control the space between FlowLayoutPanel’s child controls. But you can add a panel between the FlowLayoutPanel’s child controls to increase the ‘space�

3) I think this is because that your UserControl has a large size, you can try to set the size of your UserControl to solve this problem.

Code Block

myUserControl.Height = 50;

usUrControl.Width = 50;

Also, you can set the Padding to specify the interior space of the FlowLayoutPanel.

Hope this helps.
Best regards.
Rong-Chun Zhang

Rong-Chun Zhang  Tuesday, October 23, 2007 7:11 AM

You can use google to search for other answers

Custom Search

More Threads

• Accessing classes among projects in a solution
• programming radio buttons
• About the Bitmaps rending....HC~~HELP~~~
• run time set focus to gridview
• Localization, string resource files and Windows Forms
• inaccessible text box in disable panel !!
• "A generic error occurred in GDI+", not to save an image
• WebBrowser.Url bug?
• Database question
• Making Help, Minimize, Maximize/Restore and Close Caption Buttons Visible