Click here to Skip to main content
15,916,600 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am using a none data bound DataGridView (with C#, VS2008)to display a tabular data that spans up to 20 columns. Obviously, only small portion of the columns can be displayed on the screen. The application must allow the user to reorder the columns and I enabled the AllowUserToOrderColumns property of the DataGridView control. However, I cant automatically control the horizontal scroll bar so that users can drag and drop columns easily.

Can any one point me to the remedy for the problem.Can someone please give me some idea how to build my own custom DataGridView control that support Column Reordering with auto horizontal scrolling.
Yon
Posted

What I understood from your problem is that you want the GridView to auto scroll when you selects a column and drag it past to last visible column.

To do this , you can write code in CellMouseEnter/Move event and check that current column is last visible. You can check it by

FirstDisplayedScrollingColumnIndex property and also can set new value.
 
Share this answer
 
thank you very much but I have tried this and the problem is the grid still do not scroll easily back and forth
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900