Mam problem z FlowLayoutPanel i nie wiem jak go rozwiązać.Jak uzyskać FlowLayoutPanel.AutoSize do pracy z FlowBreak
Umieszczam dwa FlowLayoutPanels wewnątrz innego; drugi wewnętrzny flp ma 3 przyciski wewnątrz.
Właściwości od FlowLayoutPanel dziecka są:
FlowDirection = LeftToRight;
AutoSize = true;
AutoSizeMode = GrowAndShrink;
WrapContents = true;
Teraz mogę ustawić dla każdego przycisku właściwość true FlowBreak
jednak zachowanie widzę nie jest jeden chcę, chcę FlowLayoutPanel się kurczyć do szerokości przycisków,
Zmiana FlowDirection
do UpToDown
nie jest opcją.
Ktoś wie, dlaczego funkcja AutoSize nie działa?
to jest kod.
//
//FlowLayoutPanel1
//
this.FlowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.FlowLayoutPanel1.Controls.Add(this.FlowLayoutPanel3);
this.FlowLayoutPanel1.Location = new System.Drawing.Point(84, 77);
this.FlowLayoutPanel1.MinimumSize = new System.Drawing.Size(10, 10);
this.FlowLayoutPanel1.Name = "FlowLayoutPanel1";
this.FlowLayoutPanel1.Size = new System.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 = new System.Drawing.Point(127, 3);
this.FlowLayoutPanel3.MinimumSize = new System.Drawing.Size(10, 10);
this.FlowLayoutPanel3.Name = "FlowLayoutPanel3";
this.FlowLayoutPanel3.Size = new System.Drawing.Size(162, 87);
this.FlowLayoutPanel3.TabIndex = 1;
//
//Button1
//
this.FlowLayoutPanel3.SetFlowBreak(this.Button1, true);
this.Button1.Location = new System.Drawing.Point(3, 3);
this.Button1.Name = "Button1";
this.Button1.Size = new System.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 = new System.Drawing.Point(3, 32);
this.Button2.Name = "Button2";
this.Button2.Size = new System.Drawing.Size(75, 23);
this.Button2.TabIndex = 1;
this.Button2.Text = "Button2";
this.Button2.UseVisualStyleBackColor = true;
//
//Button3
//
this.Button3.Location = new System.Drawing.Point(3, 61);
this.Button3.Name = "Button3";
this.Button3.Size = new System.Drawing.Size(75, 23);
this.Button3.TabIndex = 2;
this.Button3.Text = "Button3";
this.Button3.UseVisualStyleBackColor = true;
to jest problem w moim GUI jedna kontrola https://docs.google.com/document/d/1I6OtboresNk-gfOR3sEM8gyYHVX9sGohdNtX6heeQwI/edit?usp=sharing kiedy kładę 2 kontrole i ustawić FlowBrake do Prawda https://docs.google.com/document/d/17C02PoL8LCyymfXNtEP8N6kkzZETxkiOCb6mPTbzGf0/edit?usp = sharing Chcę, aby kontrolki pozostały w górze, ale ze względu na to, że zmiana szerokości nie pasuje. – Natalia
Czy możesz dodać dwa obrazy - jeden z tym, co masz, a drugi z tym, co próbujesz osiągnąć. Z opisu tekstowego nie jest jasne, z jakim problemem masz do czynienia: –
Dodałem nowy obraz z wynikiem, aw moim poprzednim komentarzu umieściłem dwa linki z zachowaniem na moim GUI – Natalia