How to force the Scrollbar in DataGridView

  • Thread starter Thread starter Rene.Scharf
  • Start date Start date
R

Rene.Scharf

Hello NG,

I'm using the following method to modify the High o Datagrid-Rows

void SetGridRowHeight(DataGrid dg, int rowNumber, int cy)
{
BindingFlags bf = BindingFlags.NonPublic | BindingFlags.Instance;
ArrayList rows = (ArrayList)dg.GetType().GetField("m_rlrow",
bf).GetValue(dg);
object row = rows[rowNumber];
row.GetType().GetField("m_cy", bf).SetValue(row, cy);
dg.Invalidate();
}

But now I've to force the Scrollbar manualy becaus it don't comes up
automatic when the sum of all RowHighs is greather then the DatagridHigh.

best regards
René

ps: I Know my english isn't the best. But i hope you can understand the
problem. otherwhise ask for more details. Thanks
 
You can show the scrollbar like this:

ScrollBar sb = (ScrollBar)typeof(DataGrid).GetField("m_sbVert",
BindingFlags.NonPublic|BindingFlags.GetField|BindingFlags.Instance).GetValue(dg);
sb.Visible = true;
 
Back
Top