Bob,
I know how cool custom scrolls can be. This is just me I would make all the
columns fit exactly on the visible display area of the data grid by adjusting
the column width. Too many columns then hide the columns that don't fit.
You'll have to use the tablestyles collection
Its dificult to setup but here goes
click properties
set the width to 420
select tablestyles collection and go to the designer ...
add a tablestyle just click the big add button
in the mapping name select your datamember (datamember on grid) name from
the drop down list
go into the grid columns styles collection designer ... (same designer)
in the mapping name select your first column from the drop down list.
set width to 100
do the same for the next three columns
for all the remaining columns set the width to zero.
when you run the datagrid will display the first four columns.
In the cool scroll click to move right. make columns visible by changing
the width to non zero.
datagrid1.TableStyles.Item(0).GridColumnStyles.Ite m(0).Width=0
datagrid1.TableStyles.Item(0).GridColumnStyles.Ite m(4).Width=100
Sorry I don't know how to progamatically create a table styles collection at
run time you'll have to do it manually in the designer.
Good Luck
DWS
"Bob The Builder" wrote:
I have a custom-built datagrid for windows forms. I overrode the
scrollbars in it because I wanted to draw my own (basically, they're
skinned). As a result, I handle all scroll events and calls. I also
have a row-selector column as the first column, and that needs to stay
visible. Think Excel. However, if a user clicks a cell that is all
the way to the right and goes off the grid a bit, then the entire grid
shifts, including my row-selector column. I can't find any event that
seems to coincide with this. Yes, CurrentCellChanged fires, but by
then it's too late to prevent the grid from scrolling.
So, does anyone know a good way to make a column freeze (this is a
windows forms application), and how can I prevent the grid from auto
scrolling? Thanks