We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Horizontal Scrolling in GridDataBoundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

29064 May 16,2005 01:40 PM UTC May 17,2005 02:25 PM UTC WinForms 7
loading
Tags: GridControl
Ramya Modukuri
Asked On May 16, 2005 01:40 PM UTC

I am using a GridDataBoundGrid that is being bound to a DataTable with n columns. Whenever I set a frozen count of x, and scroll horizontally, the scrolling freezes at (n-x) columns. I am able to fix this problem by setting the HScrollPixel property to false. However, when I do this, there is an empty space to the right of the last column, which I need to get rid of. Is there any way to prevent the scrolling freeze AND get rid of the empty space? I am attaching a sample application to demonstrate the problem. Right click to freeze columns and set the number of cols. ScrollTest_2371.zip

Administrator [Syncfusion]
Replied On May 16, 2005 02:11 PM UTC

Trying to freeze more columns than are visible is a problem. And I think this is causing the problem you are seeing. Here is a little tweaking of your code to try to prevent this. private void Form1_Load(object sender, System.EventArgs e) { _grid.Model.Rows.HeaderCount = 0; _grid.Model.Cols.HeaderCount = 1; _grid.DataSource = _createTable(25, 50); _grid.Model.Cols.SetFrozenCount(1, true); } private void menuFreeze_Click(object sender, System.EventArgs e) { int rowIndex, colIndex; this._grid.PointToRowCol(_rightClickPoint, out rowIndex, out colIndex); if (colIndex > this._grid.Model.Cols.HeaderCount && this._grid.Model.ColWidths.GetTotal(0,colIndex) < this._grid.ClientSize.Width) { this._grid.Model.Cols.FrozenCount = colIndex; _grid.LeftColIndex = colIndex + 1; } }

Administrator [Syncfusion]
Replied On May 16, 2005 02:42 PM UTC

Here is a forum thread that I think discusses the behavior you want to get. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=19149

Ramya Modukuri
Replied On May 16, 2005 04:15 PM UTC

This code has a different issue. Run the app and resize the form so that you can see exactly 10 columns (out of 25). Now freeze the first 6 columns. When you scroll horizontally, the last column you can see when the scrollbar is all the way to the right, is Col22. However, if you increase your form size, all the columns are visible. This is misleading. When the scrollbar hits the max position, col 25 should be visible. I am looking through the other message, but the issue there is with the current position being reset when columns are frozen. I don''t care if the scroll bar jumps back to the start position when I freeze, as long as scrolling works as expected with frozen columns. I just need the grid to behave such that when the first x columns are frozen, that I can still scroll to the last column without having to resize my window, having to use the arrow keys or having an empty space to the right of the last column. Thanks.

Ramya Modukuri
Replied On May 16, 2005 09:13 PM UTC

Any updates on this? >Here is a forum thread that I think discusses the behavior you want to get. > >http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=19149

Administrator [Syncfusion]
Replied On May 16, 2005 09:15 PM UTC

I see the problem, but do not have a suggestion yet.

Administrator [Syncfusion]
Replied On May 17, 2005 11:52 AM UTC

Here is a work around until we can get a release out that has this corrected. The idea is to use HScrollPixel=false so the scrolling works ok, but to extend the right-most column to fill up the empty space on the right side of the grid that you do not want to see. Maybe this will serve your needs until we get this corrected. //at the bottom of form.load this._grid.HScrollPixel = false; this._grid.Model.QueryColWidth += new GridRowColSizeEventHandler(Model_QueryColWidth); this._grid.HScrollBar.Scroll += new ScrollEventHandler(HScrollBar_Scroll);
//the handlers
private void HScrollBar_Scroll(object sender, ScrollEventArgs e)
{
	if(this._grid.ViewLayout.LastVisibleCol == this._grid.Model.ColCount)
		this._grid.InvalidateRange(GridRangeInfo.Col(this._grid.ViewLayout.LastVisibleCol));
}
private void Model_QueryColWidth(object sender, GridRowColSizeEventArgs e)
{
	if(e.Index == this._grid.Model.ColCount)
	{
		//starts at 1 as headers are hidden...
		int w = this._grid.Model.ColWidths.GetTotal(1, this._grid.Model.Cols.FrozenCount)
			+ this._grid.Model.ColWidths.GetTotal(this._grid.LeftColIndex, e.Index - 1);
		e.Size = this._grid.ClientSize.Width - w;
		if(e.Size > 0)
			e.Handled = true;
	}
}

Ramya Modukuri
Replied On May 17, 2005 02:25 PM UTC

Thanks! Looks like this works.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;