Clay,
thanks for all your help. I had the time to look through my code and all the grid's properties. I have found the cause of my problem:
As I did not want to have any horizontal scrolling, I have set the HScrollBehavior to Disabled and thought that it would be a good idea to set VScrollBehavior to Enabled. I have now set VScrollBehavior back to default (DetectIfShared) and now it does what it is supposed to be doing: It adjusts the top row index.
Regards
Kai Iske
> Kai,
>
> I think I am losing my mind.
>
> Yesterday when I looked at this I did a little sample, and immediately saw what you are talking about. Now this morning, I bring up that sample, and do not see the problem. As I size the grid taller, the top row reduces to try to fill the clientheight. I have swap out versions a couple of times since I originally looked at the sample. This morning I have tried it with 1.5.2.0 and tbe beta code for 1.6, and do not see the problem. What version are you using so I can try it (in case something has been corrected that fixes this problem).
>
> As far as handling hidden rows or variable row heights, you can probaly use code such as this (could not check it out as I no longer see the behavior). The first loop is your code setting the colwidths. The part adjusts the toprowindex if needed:
>
> private void gridControl1_SizeChanged(object sender, System.EventArgs e)
> {
> int width = this.gridControl1.ClientRectangle.Width - this.gridControl1.ColWidths[0];
> for(int i = 1; i < 4; ++i)
> this.gridControl1.ColWidths[i] = width / 3;
>
> if(this.gridControl1.TopRowIndex > this.gridControl1.Rows.FrozenCount + 1
> && this.gridControl1.ViewLayout.LastVisibleRow == this.gridControl1.RowCount)
> {
> int topRow = this.gridControl1.TopRowIndex;
> int targetHeight = this.gridControl1.ClientSize.Height
> - this.gridControl1.RowHeights.GetTotal(0,this.gridControl1.Rows.FrozenCount);
> int currentHeight = this.gridControl1.RowHeights.GetTotal(topRow, this.gridControl1.RowCount);
> while (topRow > this.gridControl1.Rows.FrozenCount + 1 &&
> targetHeight > currentHeight + this.gridControl1.RowHeights[topRow-1])
> {
> topRow--;
> currentHeight += this.gridControl1.RowHeights[topRow];
> }
> this.gridControl1.TopRowIndex = topRow;
> }
> }
>
>