FlowLayoutPanel AutoSize only in vertical?
Solution 1
Simple, add a event of type control added:
private void flowLayoutPanel1_ControlAdded(object sender, ControlEventArgs e)
{
if (flowLayoutPanel1.Controls.Count % 10 == 0)
flowLayoutPanel1.SetFlowBreak(e.Control as Control, true);
}
set AutoSize = true
set flowdirection = LeftToRight
Solution 2
Maybe
FlowLayoutPanel1.WrapContents = False;
FlowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
will help you.
Solution 3
I did set the Size from panel dinamically. Example:
int newHeight= listImages.Count/10 * 100; flowLayoutPanel1.Size = new Size(1143, newHeight);
It works for me. Thx all
Ladessa
I ‘ve been working as Mobile Developer for more than 9 years. In this period, I’d the opportunity to developer more than 17 IOS projects, 5 Android Applications, 02 hybrid applications in HTML5 and another projects in React Native. I worked in 02 startups, where I’ve learned how to make a structure for a small company, where is necessary not only practice your specialty, but also developer a program in another platform. At All Apps, I led a technical team. I had the opportunity to understand a little more about the challenges to lead and coach a team. Then, at S2IT, a medium company with a solid structure, I’d learned and understood a lot of things about all the process. I worked too at the C&A’s Office where I’d the opportunity to participate of all the process to developer a Company’s Corporate Applications and I worked at Itaú helping the company to evolve your B2C iOS and Android Application. Finally, I'm working at Lojas Renner S.A as Mobile Specialist and I am so proud to belong this team. Everyday I work to give my best for the company. In 2019 I am postgraduated in IoT Internet of the Things at SENAI and I am searching about Smart Home. My focus is Z-wave protoco
Updated on September 28, 2022Comments
-
Ladessa over 1 year
I'm loading images dynamically inside a
FlowLayoutPanel
. I need for this panel to auto-size but only vertically.Is this possible, and if so, how do I go about achieving it?
-
string.Empty about 11 years
int newHeight= listImages.Count/10 * 100;
is the same as intnewHeight= listImages.Count * 10;
-
Ladessa about 11 yearsI know but int newHeight= listImages.Count/10 * 100; its better for understand that 10 is the number of pictures per line and 100 the height from each one
-
Tim Meyer almost 9 yearsHint: it would even be more readable and maintainable like this:
int newHeight= listImages.Count / numberOfPicturesPerLine * pictureHeight
, with definitions likeconst int numberOfPicturesPerLine = 10;
-
Giancarlo over 4 yearsThis will add the controls in a vertical way, but the list is now larger than my panel, and my scrollbar is gone, how do I get it back again?
-
string.Empty over 4 years@Giancarlo there could are multiple reasons why your scrollbar is not showing. All this does is set the amount of controls per a row. I suggest doing some further research and tinkering and if you still struggling ask a new question.