tags:

views:

438

answers:

1

I have a huge datagrid control embedded in a window and Autoscroll property to true. Control also has textboxes in addition to the grid .This grid is meant for monitors with resolution above 1600(and so scrollbar not visible at that resolution). But Autoscroll property is set to make incase user uses it in smaller monitors also.

Working is like when clicking a cell for e.g cursor is set in a text box which is located at far right of the grid and so not visible in small monitors. But due to the functionality i described above whenever i click a cell the grid loses focus and scrollbar moves to the right side of the grid.

I don't want the scrollbar to move to focus on the textboxes. Help needed.Thanks.

A: 

"Just in case someone stumbles across this post searching for a way to disable the AutoScroll behavior of scrolling to the focused control, the cleanest solution is provided in .NET 2.0: There is an overrideable ScrollToControl method in the ScrollableControl now. Replace the call to the base class implementation to return DisplayRectangle.Location and problem solved"

-- A gem in comments section of this great blog post : http://seewinapp.blogspot.com/2005/09/is-your-autoscroll-too-auto.html

The blog post and the comment answered the need

blntechie