Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Scrolling reset when application regains focus

Scrolling reset when application regains focus

Scheduled Pinned Locked Moved C#
help
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pr1mem0ver
    wrote on last edited by
    #1

    Whenever my application loses focus, the scrolling of a panel is reset to the top position once focus is regained. This is really annoying. I have tried everything I can think of and researched to fix this such as overriding the scroll mechanism and saving coordinates; also doing the same during a mouse wheel scroll and trying to restore with the following method:

    private void OnFormActivated(object sender, EventArgs e)
    {
    panel1.AutoScrollPosition = panelRect.Location; // panelRect is the location saved
    }

    B 1 Reply Last reply
    0
    • P pr1mem0ver

      Whenever my application loses focus, the scrolling of a panel is reset to the top position once focus is regained. This is really annoying. I have tried everything I can think of and researched to fix this such as overriding the scroll mechanism and saving coordinates; also doing the same during a mouse wheel scroll and trying to restore with the following method:

      private void OnFormActivated(object sender, EventArgs e)
      {
      panel1.AutoScrollPosition = panelRect.Location; // panelRect is the location saved
      }

      B Offline
      B Offline
      BillWoodruff
      wrote on last edited by
      #2

      This works for me: [^]. But, if your Panel is nested inside a Form, or other ContainerControl, with scrolling enabled/visible ... I don't know.

      «Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups