16

I am adding some controls to Flow layout panel. In between some controls I need a line break. How can I achieve this please. Thanks

Rob
  • 45,296
  • 24
  • 122
  • 150
dps123
  • 1,033
  • 6
  • 19
  • 26

3 Answers3

47

After adding the last control before the break, call flow.SetFlowBreak(lastControl, true).

Note: lastControl is the control that you want set new line after that.

John Hatton
  • 1,734
  • 18
  • 20
  • 15
    Or, to set FlowBreak from the VS2010 GUI: Scroll to the bottom of the **PropertyPanel** for the control before the line break, and set **FlowBreak** to **True**. – Brian Gillespie May 18 '12 at 16:22
13

The best answer is by far the comment made by Brian Gillespie:

Set FlowBreak from the VS2010 GUI: Scroll to the bottom of the PropertyPanel for the control before the line break, and set FlowBreak to True.

Appulus
  • 18,630
  • 11
  • 38
  • 46
Zyo
  • 1,934
  • 21
  • 25
0

You need a custom control which resizes itself to the end of a flow panel, and has a zero height / width, depending upon the flow direction of a flow panel

Alan Turing
  • 2,482
  • 17
  • 20
  • Lets say I am using a Label without a caption, is there a way to identify the width of the label. – dps123 Feb 20 '11 at 01:51
  • I think this is a terrible solution, for it involves creating a custom control and code, while there is an alternative available that involves no code and was clearly intended for exactly this purpose. (See the answer given by Zyo, and the comment by Brian Gillespie.) – Joeppie Oct 29 '15 at 13:11
  • Agreed, see answer by Zyo below. This is built-in functionality. – Dave D Nov 22 '15 at 19:53
  • The question is a tad vague, thus the best answer is a likely a combination of the above. Artur's answer was accepted by the owner of the question without anyone stating/clicking the answer as useful... that's unfortunate. If you are "adding some controls" programmatically, then you can't use the Property Panel. John, Brian and Artur all have good input... depending on how you're putting the controls in the FlowLayoutPanel. This stuff is a little tricky. – TravelDev Dec 09 '22 at 00:27