Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Bug in SmartFit

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

Bug in SmartFit
Link Posted: 05-Aug-2006 13:00
it seems like SmartFit doesn't work properly but it corrects itsself if you resize the grid.

I assume this is a known bug and will be fixed in the next update.

A video of the bug:
http://acutedream.com/photontrader/videos/market%20depth/market%20depth.html

Joe
Link Posted: 05-Aug-2006 23:16
Can you provide me with a code sample?
You can send code to or publish here.
Link Posted: 06-Aug-2006 14:25
Okay i found a fix while creating a test app for the bug.

I was using BeginUpdate and EndUpdate (which was wrong on my part)
when i changed it to BeginInit/EndInit it works fine

Here's the test app.
http://www.acutedream.com/photontrader/videos/market%20depth/FlyGridTest.rar
Link Posted: 06-Aug-2006 21:39
Thanks for the sample,
I've tested your sample and found that using BeginUpdate/EndUpdate pair.
This is incorrect code:
[c#]
private void btnAddElements_Click(object sender, EventArgs e)
{
  grid.BeginUpdate();
  Random rnd = new Random();
  for (int i = 0; i < 5; i++)
  {
    SetCellValue(i, \"Bid Qty\", rnd.Next(int.MaxValue));
    SetCellValue(i, \"Bid Price\", rnd.Next(int.MaxValue));
    SetCellValue(i, \"Ask Qty\", rnd.Next(int.MaxValue));
    SetCellValue(i, \"Ask Price\", rnd.Next(int.MaxValue));
  }
  grid.EndUpdate();
}

Use following code (without BeginUpdate/EndUpdate):

[c#]
private void btnAddElements_Click(object sender, EventArgs e)
{
  Random rnd = new Random();
  for (int i = 0; i < 5; i++)
  {
    SetCellValue(i, \"Bid Qty\", rnd.Next(int.MaxValue));
    SetCellValue(i, \"Bid Price\", rnd.Next(int.MaxValue));
    SetCellValue(i, \"Ask Qty\", rnd.Next(int.MaxValue));
    SetCellValue(i, \"Ask Price\", rnd.Next(int.MaxValue));
  }
}


or use BeginInit/EndInit:
[c#]
private void btnAddElements_Click(object sender, EventArgs e)
{
  grid.BeginInit();
  try
  {
    Random rnd = new Random();
    for (int i = 0; i < 5; i++)
    {
      SetCellValue(i, \"Bid Qty\", rnd.Next(int.MaxValue));
      SetCellValue(i, \"Bid Price\", rnd.Next(int.MaxValue));
      SetCellValue(i, \"Ask Qty\", rnd.Next(int.MaxValue));
      SetCellValue(i, \"Ask Price\", rnd.Next(int.MaxValue));
    }
  }
  finally
  {
    grid.EndInit();
  }
}