samedi 18 avril 2015

DataGridView shuffling column widths depending on visibility when control is added

Demo of problem


Both the 'Load' button on tabPage2 and the 'Load' Menu Item are running the same code, but as you can see in the demo above when the control is added when tabPage2 is not selected, the column widths shuffle despite it being the exact same code, the exact same control with the exact same content.


I'm not sure how relevant it is to the problem, but the UserControl I am adding looks like this:


Added user Control


Just a tab control with two tabs, a split container on the first tab with a DataGridView in the bottom split panel.


Each 'Load' creates a new tab page, a new user control, adds the user control to the tab page and then adds the tab page to the tab control on tabPage2.


Is there something at play here that I'm not aware of that would make controls render differently depending on their visibility when added?


Aucun commentaire:

Enregistrer un commentaire