Disabling Some Autoscroll Functionality

This is a discussion on Disabling Some Autoscroll Functionality within the C# Programming forums, part of the General Programming Boards category; Hi, I've got a large collection of forms inside of a Panel, and the panel has Autoscroll = true. When ...

  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    3

    Disabling Some Autoscroll Functionality

    Hi,
    I've got a large collection of forms inside of a Panel, and the panel has Autoscroll = true. When a panel has Autoscroll on, the default behavior is for the "viewing area" of the scroller to make the upper-left corner of a control visisble if it gets focus at a time when that control is outside the scroller's client area.

    Now I want to make it so that there is an auto scroll bar but it does not scroll to a component that gets the focus. I have found that this scrolling is annoying to the user rather than helpful in this case. Thanks if anyone can help.

    BTW: Most of the time I'm dealing w/ a vertical scroller.

  2. #2
    BMJ
    BMJ is offline
    Banal internet user BMJ's Avatar
    Join Date
    Aug 2002
    Location
    Chicagoland
    Posts
    1,380
    Well, here's my suggestion but it seems kinda hack-ish...

    - Create a new Panel class that captures scroll events (see http://blogs.msdn.com/rickbrew/archi...24/165493.aspx)

    - On the new Panel's scroll event, store the AutoScrollPosition

    - Have the new Panel's controls handle GotFocus events, and set the new Panel's AutoScrollPosition to the old position which you have stored.


    There might be a better way to do this though. Maybe you should consider an alternative.

  3. #3
    Registered User
    Join Date
    Sep 2004
    Posts
    3

    Followup; Stopping Flickers

    It turns out that the scroll-to-focus scrolling does not actually generate any messages, however that example BMJ gave was helpful since it showed me that the AutoScrollPosition property returns negative values for some twisted reason.

    I have heard it suggested that one can make derived controls and set their ConstrolStyle.Selectable to false prevents them from getting focus but I just tried this on some tab controls and they definitely still get focus.

    So now I've got a hack with a custom window that can "snap back" to a store scroll position when needed. However, there's a flicker. Is there a way to somehow suspend the drawing of a control and its child components during the scroll?

  4. #4
    BMJ
    BMJ is offline
    Banal internet user BMJ's Avatar
    Join Date
    Aug 2002
    Location
    Chicagoland
    Posts
    1,380
    You can try sending a WM_SETREDRAW message to set the panel not to redraw, adjust the AutoScrollPosition, then set the redraw back.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Time-of-Day Functionality WITHOUT Standard Libs
    By JDGATX in forum C Programming
    Replies: 6
    Last Post: 03-11-2008, 10:43 AM
  2. Drag and drop functionality
    By tazz25 in forum Tech Board
    Replies: 5
    Last Post: 07-15-2006, 11:47 PM
  3. Are shaders faster than fixed functionality
    By psychopath in forum Game Programming
    Replies: 1
    Last Post: 07-08-2005, 03:14 PM
  4. disabling ALL keys?
    By elfjuice in forum C++ Programming
    Replies: 2
    Last Post: 04-30-2005, 03:58 PM
  5. Disabling a listitem
    By knutso in forum Windows Programming
    Replies: 3
    Last Post: 02-21-2004, 10:39 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21