c# - TableLayoutPanel with Horizontal Scrollbar and Child Layout Behavior Unexplained -


i seeing weird behavior in tablelayoutpanel trying use vertically stacked panel (no horizontal scroll bar, vertical).

i have setup here tablelayoutpanel docked right of form. removed row , column styles created default. column style size type percent (100%). row style size types autosize. i've set autoscroll true, , cellborderstyle single because issue happens when property set.

here relevant code buttons:

private void button1_click(system.object sender, system.eventargs e) {     panel p = new panel();      p.dock = dockstyle.fill;     p.borderstyle = borderstyle.fixedsingle;      this.tablelayoutpanel1.controls.add(p); }  private void button2_click(system.object sender, system.eventargs e) {         {         this.tablelayoutpanel1.performlayout();     } while (this.tablelayoutpanel1.horizontalscroll.visible); } 

and here pictures explaining issue.

picture 1 - i've clicked button1 once, adding single docked panel tablelayoutpanel.

tablelayoutpanel_1

picture 2 - i've clicked button1 4 more times, getting 5 docked panels , causing horizontal scroll bar appear. @ point, don't understand why vertical scroll bar appearing hasn't shifted on docked panels there no horizontal scroll bar.

tablelayoutpanel_2

picture 3 - i've clicked button2 once, causing loop run where, oddly, every performlayout call decreases docked panel's width 1, causing horizonal scroll bar go away.

tablelayoutpanel_3

questions

  1. why, when add fifth panel, horizontal scroll bar appear? every panel docked, don't understand why when vertical scroll bar appears doesn't cause panels width decrease vertical scroll bar width (like docked panel should behave).

  2. what going on layout engine causing decrease width's 1 after every peformlayout call? suspicion is bug relating cellborderstyle property being set single.

  3. my third, , important question myself is: best way reliable, vertically stacked panel there 1 control per row, , size dependent on width of parent container? solution should @ no point have horizontal scroll bar appear. preferably out of box type solution (no custom controls).


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -