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. Image for the cookie policy date
close icon

GridControl automatically horizontally scrolls right

Hi,

I'm wondering if this is possible. I want to use the grid to allow me to show the contents of a massive file, so I'm using it as a virtual grid. I have two columns, the first one being narrow, just to hold a line number value. The second column I want to use to show the line from the file. The problem is the line in some cases is over a thousand characters wide.

I have two problems. First, when the user selects the second column with the mouse, the grid automatically scrolls to fit as much of the second column in the view as possible, so the line number column just disappears; I dont want this to happen. My second problem is that I cannto seem to get the column width of the second column wide enough. I am handling QueryColWidth and returning something like 3000, which just abouts first one of my lines.

I'm wondering if there is a better control to view this. I'm basically needing to render a large file, both vertically and horizontally, using two columns.

Any advice most appreciated.

Nick.

1 Reply

HA haneefm Syncfusion Team November 2, 2007 10:10 PM UTC

Hi Nick,

Regarding the First Issue :
>>>>>>>>>>>>>>>>>>>>>>>>
The AllowScrollCurrentCellInView property specifies the mask for which reason the scrolling should happen, this defines the ScrollCurrentCellInView behavior of the grid. You can try setting this to GridScrollCurrentCellReason.None and let me know if this helps.

this.gridControl1.Model.Options.AllowScrollCurrentCellInView = GridScrollCurrentCellReason.None;

Regarding the Second Issue :
>>>>>>>>>>>>>>>>>>>>>>>>
To resizetofit the column widths and rowheights for the header row in grid, the following code can be used.

grid.ResetVolatileData ();
grid.Model.ColWidths.ResizeToFit(GridRangeInfo.Cells(1,1,grid.ColCount,grid.RowCount));
grid.Model.RowHeights.ResizeToFit(GridRangeInfo.Row(0));

If you are handling the QueryColWidth and QueryRowHeight events, then you can follow the approach mentioned in the below forum thread by having a hashtable to cache the changed sizes and set this in the query events.
http://www.syncfusion.com/support/Forums/message.aspx?MessageID=33561

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon