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. How to suppress a scroll bar

How to suppress a scroll bar

Scheduled Pinned Locked Moved C#
helpwpftutorialquestion
3 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.
  • J Offline
    J Offline
    jjansen
    wrote on last edited by
    #1

    I noticed that when the XP visual styles are on, the Panel control sometimes adds a horizontal scroll bar when it is not necessary. The controls in the Panel fit the visible area fine (including the scroll margin and vertical scroll bar). This does not happen when the visual styles are off, i.e. in the Windows classic style X| ! It doesn't matter if the AutoScroll property is set to true or false. To fix this problem I wanted to hide the horizontal scroll bar manually. I tried to use the HScroll property. The MSDN documentation on the ScrollableControl (from which Panel is derived) class says: "To manually override which scroll bars are visible, set the VScroll and HScroll properties. If either property is set to false, the corresponding scroll bar is not visible, even if the AutoScroll property is set to true." This simply isn't true :mad:. You can set the property HScroll to false, but the horizontal scroll bar is still there and remains functional. The method SetScrollState doesn't work either. Does anyone know how I can suppress a horizontal scroll bar in a panel? Thanks.

    J 1 Reply Last reply
    0
    • J jjansen

      I noticed that when the XP visual styles are on, the Panel control sometimes adds a horizontal scroll bar when it is not necessary. The controls in the Panel fit the visible area fine (including the scroll margin and vertical scroll bar). This does not happen when the visual styles are off, i.e. in the Windows classic style X| ! It doesn't matter if the AutoScroll property is set to true or false. To fix this problem I wanted to hide the horizontal scroll bar manually. I tried to use the HScroll property. The MSDN documentation on the ScrollableControl (from which Panel is derived) class says: "To manually override which scroll bars are visible, set the VScroll and HScroll properties. If either property is set to false, the corresponding scroll bar is not visible, even if the AutoScroll property is set to true." This simply isn't true :mad:. You can set the property HScroll to false, but the horizontal scroll bar is still there and remains functional. The method SetScrollState doesn't work either. Does anyone know how I can suppress a horizontal scroll bar in a panel? Thanks.

      J Offline
      J Offline
      jjansen
      wrote on last edited by
      #2

      I still haven't been able to suppress the scroll bar. The panel totally ignores the property HScroll and other scroll bar methods :mad:. However, I can now hide the scroll bar using the Interop function ShowScrollBar, although it doesn't prevent the scroll bar to appear briefly.

      A 1 Reply Last reply
      0
      • J jjansen

        I still haven't been able to suppress the scroll bar. The panel totally ignores the property HScroll and other scroll bar methods :mad:. However, I can now hide the scroll bar using the Interop function ShowScrollBar, although it doesn't prevent the scroll bar to appear briefly.

        A Offline
        A Offline
        amymarie3
        wrote on last edited by
        #3

        Could I get an example of how to do this, I have never used Interop before.

        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