I have a case where we are integrating some .NET controls with an old VB6 app. The VB app stores some user settings in the registry so that when the user changes column order/sizing in a grid, the app remembers.
In the .NET control i'm using the new wingrid, however there was a very strange behavior i encountered. My column was default Hidden. In the Initialize_layout event, i grab the width setting from the registry, set the column width on this hidden column, and then later in a different method set the Hidden property to false.
The effect was that from the time i set the width to the time the grid shows on the screen, the width has been increased. If the form is closed and subsequently opened, the column will continue to grow. I was able to negate this behavior by setting the column to visible default, but i still don't understand what was going on. Is this possibly a bug or is there something that happens with the siziing on hidden columns that i do not understand?
Hi Jason,
It's hard to know for sure without seeing the behavior. But here are a few wild guesses. :)
1) You are using AutoFitStyle or AutoFit on the DisplayLayout.If you are using AutoFit, then hiding and showing a column will change the size of that column because when you hide the the column, the other columns resize proportionally and thus become bigger than the hidden column. When you then show the column, it is now proportionally smaller than the other columns which were not hidden.
2) Using the DotNet grid in VB6 is not something we test or actively support. So this could be an issue with the environment.
If definately had something to do with the AutoFitStyle property. I turned it off and the issue went away.
With that said, i'm still not exactly sure what the sequence of hiding/resizing/unhiding was causing the weird behavior, but I've been able to workaround the issue.