c# - TableLayoutPanel changing it's sizing -


i have few tablelayoutpanels in program in order lay out different controls in rows. until these working correctly, after change in server no longer case. potential cause change in screen resolution noticed similar problems on other computers running program.

an example of problem shown below

enter image description here

before data rows loaded (from database), sizing incorrect. measurement using vs designer shows size in figure 2 correct. interestingly, if add blank row table resizing doesn't happen.

public jobopmaintable() {     doublebuffered = true;     autosize = true;     autosizemode = system.windows.forms.autosizemode.growandshrink;     doublebuffered = true;     backcolor = color.white;     cellborderstyle = tablelayoutpanelcellborderstyle.single;     headers(); }  private void headers() {     string[] names = { "operation", "est lab hrs", "est um hrs", "act lab hrs", "act um hrs" };     (int = 0; < names.length; i++) header(names[i], i); }  private void header(string name, int col) {     panel pan = new panel();     pan.width = widths[col];     pan.height = 25;     pan.backcolor = color.black;     pan.dock = dockstyle.fill;     pan.margin = new system.windows.forms.padding(0);     textbox txt = new textbox();     txt.font = new system.drawing.font("microsoft sans serif", 8, fontstyle.bold);     txt.text = name;     txt.readonly = true;     txt.backcolor = color.black;     txt.forecolor = color.white;     txt.dock = dockstyle.fill;     txt.borderstyle = system.windows.forms.borderstyle.none     pan.controls.add(txt);     controls.add(pan, col, 0); }  private int newrow() {     int row = controls.count / 5;     (int = 0; <= 4; i++)     {         textbox txt = new textbox();         txt.width = widths[i];         txt.backcolor = color.white;         txt.borderstyle = system.windows.forms.borderstyle.none;         txt.readonly = true;         txt.dock = dockstyle.fill;         txt.margin = new padding(0);         txt.enter += new eventhandler(entercell);         txt.leave += new eventhandler(leavecell);         controls.add(txt, i, row);     }     return row; } 

above code believe relevant problem. resizing occurs first time newrow() called when loading in data: each new box makes column wider. again though, odd thing doesn't occur if add row constructor


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -