Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / December 2004

Tip: Looking for answers? Try searching our database.

AutoScroll question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
WineNCheese - 14 Dec 2004 22:00 GMT
Hello all,

I have what I would think would be a relatively common problem, but I don't
see an obvious solution to it.

Situation:
o  I have a UserControl that contains a data grid (I believe this will
happen with any control), that can be bigger than the client area of the
window.
o  The UserControl has AutoScroll set to true, so there are scrollbars if
needed.

Problem:
If the UserControl is scrolled to a position such that the grid is partially
scrolled off the window, when the control gets focus, the UserGrid is
automatically scrolled so that the upper left of the grid is in the top left
of the window.

This is seemingly because of the following (taken from the help text for
AutoScroll):

If this property is set to true, scroll bars are displayed on the form if
any controls are located outside the form's client region. ***Additionally,
when autoscrolling is on, the client area of the form automatically scrolls
to make the control with input focus visible.***

How can I prevent this?

In my specific case, the user scrolls the control down to find a checkbox to
check in the grid, and when they check it, the control scrolls before the
mouse event takes place and the wrong cell is checked.  So not only is the
control scrolling unexpectedly for the user, but the wrong data is changed
as well.  Is there a way to turn off the movement of the control upon
receiving focus?  or do I have to implement scrolling functionality myself?

Any suggestions would be greatly appreciated...

Thanx!
WineNCheese - 14 Dec 2004 22:49 GMT
Never Mind.  I set the Selectable ControlStyle for the DataGrid to false and
all seemingly works fine.

> Hello all,
>
[quoted text clipped - 35 lines]
>
> Thanx!
WineNCheese - 14 Dec 2004 23:26 GMT
After using this for a while, it seems this fix has some small side effects,
which I guess I should have predicted related to keyboard navigation through
the control.  I sincerely hope Microsoft removes this "feature" from
AutoScroll for the next release, and leaves it up to the programmer to
ensure visibility.  Or at least make it an optional feature.

WNC

> Hello all,
>
[quoted text clipped - 35 lines]
>
> Thanx!
PaddyFrenchman - 17 Dec 2004 18:33 GMT
Can you give us the snippet of code that does it?
I have the same issue...

thanks a million.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.