PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Compact Framework How to force the Scrollbar in DataGridView

Reply

How to force the Scrollbar in DataGridView

 
Thread Tools Rate Thread
Old 22-06-2007, 06:55 AM   #1
Rene.Scharf
Guest
 
Posts: n/a
Default How to force the Scrollbar in DataGridView


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





  Reply With Quote
Old 22-06-2007, 05:54 PM   #2
Jeff Hopper
Guest
 
Posts: n/a
Default Re: How to force the Scrollbar in DataGridView

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;

"Rene.Scharf" <nospam@nowhere.com> wrote in message
news:u9fOtHJtHHA.4916@TK2MSFTNGP04.phx.gbl...
> 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
>
>
>
>
>


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off