Home - Forums-.NET - FlyGrid.Net (Windows Forms) - AutoHeightMemoColumn not autoheighting

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

AutoHeightMemoColumn not autoheighting
Link Posted: 09-Apr-2007 07:44
I have an AutoHeightMemoColumn, but the rows are all still minimum height.  I've tried adjusting every property I could think of, but none of them seem to make a difference.

What I want is for all of the other columns to be SmartFit, except for the AutoHeightMemoColumn, which should Spring horizontally to fill the available width and expand the row to the proper height.  Ideally, neither the columns nor the rows should be user-sizeable or moveable.

I've tried tons combination of fits and sizing options, but in every case, the rows remain at the default row height.  The only thing I can find that's different from the sample app is that my program starts with no rows shown, and I use the SetDataBinding() method (followed by ResetColumnMap) every once in a while to show the new rows.

How do I get this to work?
Link Posted: 09-Apr-2007 08:02
Update:

I noticed, in the custom styles sample app, that if you click Use Autoheight Columns, then checked the Use DataTable checkbox, the autoheighting would disappear, leading me to believe that there's a bug when a new datasource is applied to a design-time created autoheight column.

I was able to get around this by adding the following code to my constructor:

            FlyGrid.BeginInit();
            int i = FlyGrid.Columns.GetColumnIndexFromFieldName(\"Description\");
            Column c = new AutoHeightMemoColumn(\"Description\", \"Description\");
            c.FormatFlags = (StringFormatFlags)0;
            c.TextAlign = ContentAlignment.TopLeft;
            c.FitMode = ColumnFitMode.Spring;
            FlyGrid.Columns.Items[i] = c;
            FlyGrid.EndInit();


Still, this seems hackish.
Link Posted: 09-Apr-2007 19:37
Yes, when you use IAutoHeightColumn interface implementors, please place your initialization code within FlyGrid.BeginInit\\EndInit pair of methods:
[c#]
flyGrid.BeginInit();
try
{
  //your initialization code
}
finally
{
  flyGrid.EndInit();
}

to finalize calculations in the FlyGrid and columns.
Link Posted: 10-Apr-2007 02:47
I understand the BeginInit and EndInit stuff, but should I have to destroy and recreate the design-time AutoHeightMemoColumn in order for it to work?  If I were to take out the lines between BeginInit and EndInit in my code, the AutoHeightMemoColumn would act like a standard text column.