How to get FlowLayoutPanel.AutoSize to work with FlowBreak_weixin_34406086的博客-程序员秘密

have a problem with a FlowLayoutPanel and I don't know how to solve it.

I'm placing two FlowLayoutPanels inside another; the second inner flp has 3 buttons inside.

enter image description here

The properties from FlowLayoutPanel child are:

FlowDirection=LeftToRight;AutoSize=true;AutoSizeMode=GrowAndShrink;WrapContents=true;

Now I set for each button the FlowBreak property to true, however the behavior I see is not the one I want, I want the FlowLayoutPanel to shrink to the width of the buttons,

enter image description here

Changing FlowDirection to UpToDown is not an option.

Anyone know why the AutoSize is not working?

this is the code.

////FlowLayoutPanel1//this.FlowLayoutPanel1.AutoSizeMode=System.Windows.Forms.AutoSizeMode.GrowAndShrink;this.FlowLayoutPanel1.Controls.Add(this.FlowLayoutPanel3);this.FlowLayoutPanel1.Location=newSystem.Drawing.Point(84,77);this.FlowLayoutPanel1.MinimumSize=newSystem.Drawing.Size(10,10);this.FlowLayoutPanel1.Name="FlowLayoutPanel1";this.FlowLayoutPanel1.Size=newSystem.Drawing.Size(308,265);this.FlowLayoutPanel1.TabIndex=0;////FlowLayoutPanel3//this.FlowLayoutPanel3.AutoSize=true;this.FlowLayoutPanel3.AutoSizeMode=System.Windows.Forms.AutoSizeMode.GrowAndShrink;this.FlowLayoutPanel3.Controls.Add(this.Button1);this.FlowLayoutPanel3.Controls.Add(this.Button2);this.FlowLayoutPanel3.Controls.Add(this.Button3);this.FlowLayoutPanel3.Location=newSystem.Drawing.Point(127,3);this.FlowLayoutPanel3.MinimumSize=newSystem.Drawing.Size(10,10);this.FlowLayoutPanel3.Name="FlowLayoutPanel3";this.FlowLayoutPanel3.Size=newSystem.Drawing.Size(162,87);this.FlowLayoutPanel3.TabIndex=1;////Button1//this.FlowLayoutPanel3.SetFlowBreak(this.Button1,true);this.Button1.Location=newSystem.Drawing.Point(3,3);this.Button1.Name="Button1";this.Button1.Size=newSystem.Drawing.Size(75,23);this.Button1.TabIndex=0;this.Button1.Text="Button1";this.Button1.UseVisualStyleBackColor=true;////Button2//this.FlowLayoutPanel3.SetFlowBreak(this.Button2,true);this.Button2.Location=newSystem.Drawing.Point(3,32);this.Button2.Name="Button2";this.Button2.Size=newSystem.Drawing.Size(75,23);this.Button2.TabIndex=1;this.Button2.Text="Button2";this.Button2.UseVisualStyleBackColor=true;////Button3//this.Button3.Location=newSystem.Drawing.Point(3,61);this.Button3.Name="Button3";this.Button3.Size=newSystem.Drawing.Size(75,23);this.Button3.TabIndex=2;this.Button3.Text="Button3";this.Button3.UseVisualStyleBackColor=true;
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_34406086/article/details/85614329

智能推荐

Java SimpleFileVisitor遍历文件夹与File遍历文件夹的速度对比_忽悠一夏的博客-程序员秘密

测试对比File类递归与SimpleFileVisitor类遍历文件夹的耗时:package other;import java.io.File;import java.io.IOException;import java.nio.file.FileVisitResult;import java.nio.file.Files;import java.nio.file.Path;i

日期格式yyyy-MM-dd和YYYY-MM-dd有什么区别_HEshenghuxi的博客-程序员秘密

Date result1 = string2Date("2016-12-15", "yyyy-MM-dd");System.out.println(result1);Date result2 = string2Date("2016-12-15", "YYYY-MM-DD");System.out.println(result2); Date date1 = new Date();Sys...

fastjson开发学习(一)---把对象封装成json。_fastjson组装json_cuiran的博客-程序员秘密

首先需要下载fastjson的jar包,官方也提供了下载地址和源码。fastjson:     http://www.oschina.net/p/fastjsonfastjson 是一个性能很好的 Java 语言实现的 JSON 解析器和生成器,来自阿里巴巴的工程师开发。主要特点:快速FAST (比其它任何基于Java的解析器和生成器更快,包括jackson)强大(支持普通JDK类包括任意Java

新手程序员应该知道的事_Try_again_Try的博客-程序员秘密

如果你刚进入专业的软件开发世界,那么得益于在计算机科学和编程方面的教育&培训,你已经具备了一定的知识。但是真正的开发业务工作又和在学校编程不同,这是你不可能从大学课程或编码学校中学会的东西。要想当好一名程序员我们都应该知道哪些事情?今天就让我和大家浅谈一点吧.为了了解新手程序员需要知道哪些内容,我查询了一些相关著作和博客,这些都是有着丰富的开发经验的人的总结.而今天主要的讨

随便推点

iOS毛玻璃效果的实现及图片模糊效果的三种方法_vimagematrixmultiply_灵枫静雨的博客-程序员秘密

其实在iOS7.0(包括)之前还是有系统的类可以实现毛玻璃效果的, 就是 UIToolbar这个类,并且使用相当简单,几行代码就可以搞定. 下面是代码实现: 创建一个UIToolbar实例,设置它的frame或者也可以通过添加约束 然后UIToolbar有一个属性:barStyle,设置对应的枚举值来呈现毛玻璃的样式,最后再添加到需要进行毛玻璃效果的view上即可. 毛玻璃的样式(枚举)

[Canvas系列]Canvas简单线条绘制_02_图解AI的博客-程序员秘密

在学画画的时候,线条是最基本的了,而线条的连接可以组成任何图形。在Canvas中也是如此。在开始之前我们先拿出画布和画笔:12var cvs = document.getElementById(‘cvs’); //画布var ctx = cvs.getContext(‘2d’); // 画笔我们画画的时候,落笔点是不固定的,随时都会变。canvas虽然不是通过手来决定落笔点,但也有一个方法,就是m

带你彻底了解红黑树与AVL树(详细)_qq_41055920的博客-程序员秘密

红黑树介绍红黑树,一种二叉查找树,但在每个结点上增加一个存储位表示结点的颜色,可以是Red或Black。通过对任何一条从根到叶子的路径上各个结点着色方式的限制,红黑树确保没有一条路径会比其他路径长出俩倍,因而是接近平衡的。红黑树,作为一棵二叉查找树,满足二叉查找树的一般性质。下面,来了解下二叉查找树的一般性质。二叉查找树,也称有序二叉树(ordered binary tree),或已排序二叉树(sorted binary tree),是指一棵空树或者具有下列性质的二叉树:若任意节点的左子树不空,则

百度站长平台使用教程:抓取频次_悦然wordpress建站的博客-程序员秘密

作者:悦然网络工作室原文:https://www.zsxxfx.com/2807.html我们的网站想要被收录,那就得让搜索引擎蜘蛛来抓取。所以本篇百度站长平台使用教程将为大家分享是抓取频次功能的使用。抓取频次登陆百度站长平台,点开“数据统计”-“抓取频次”就可以查看当前网站的抓取频次了,一般情况下,抓取频次是默认的,百度蜘蛛会根据你的网站情况自动做出调整。这部分是抓取时间的统计,时间单位是毫秒。调整抓取频次虽然百度蜘蛛的抓取频次会自动调整,但如果你觉得目前的抓取

单位分数_brusw的博客-程序员秘密

/** *  * 形如:1/a 的分数称为单位分数。可以把1分解为若干个互不相同的单位分数之和。例如:1 = 1/2 + 1/3 + 1/9 + 1/181 = 1/2 + 1/3 + 1/10 + 1/151 = 1/3 + 1/5 + 1/7 + 1/9 + 1/11 + 1/15 + 1/35 + 1/45 + 1/231等等,类似这样的分解无穷无尽。

程序猿的编程神器 - vim_weixin_33728708的博客-程序员秘密

一、官方文档:当你首次安装好 Vim 之后。能够用 :help tutor 或者 :help [email protected] 命令。进入一个30分钟的 Vim 新手教程。你也能够下载一个 Vim Documentation Chinese Version (Vim官方文档中文版)的安装包,安装好之后使用:help @cn 命令查看中文官方文档。另外,你还能够下载一个 Vim ...

推荐文章

热门文章

相关标签