zoukankan      html  css  js  c++  java
  • How to get FlowLayoutPanel.AutoSize to work with FlowBreak

    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;
  • 相关阅读:
    20 类中的函数重载
    19 友元的尴尬能力
    18 类的静态成员函数
    17 类的静态成员变量
    16 经典问题解析二
    15 临时对象
    Lucene4.6查询时完全跳过打分,提高查询效率的实现方式
    Lucene4.6 把时间信息写入倒排索引的Offset偏移量中,并实现按时间位置查询
    Lucene6去掉了Filter但是可以用BooleanQuery实现Filter查询
    Dom4j解析语音数据XML文档(注意ArrayList多次添加对象,会导致覆盖之前的对象)
  • 原文地址:https://www.cnblogs.com/zeroone/p/3621973.html
Copyright © 2011-2022 走看看