How to hide Scrollbar thumb? - c

Is there a way to hide the Scrollbar thumb, for example in this image Notepad does not have a thumb for both Scrollbars:
I have tried to set SCROLLINFO.nPage to 0 but it did not work.
Edit: I am talking about a control Scrollbar.

When you call SetScrollInfo, set the SIF_DISABLENOSCROLL flag in the fMask field. The scrollbar will then be disabled (and the thumb hidden) if the scroll bar's parameters make the scroll bar unnecessary.
However that technique only works for the non-client window scrollbars. If you want to disable a control scrollbar you need to do it yourself using EnableWindow().

Related

WPF Hidden ScrollViewer's Bars

I need a ScrollViewer for WPF application which like on some web pages (like Facebook), scroll bars are hidden even if content is long, but when mouse is over bars become visible. Anyone have idea how to do that?
Tnx.
MVVM focused answer:
I'm sure there is a property which allows you to hide or show the scroll bars.
Bind this property to your ViewModel.
Create a MouseOver event which fires when the mouse moves into a certain part of the screen. To do this, you could overlay an invisible grid over the screen, with the right hand 10% as the target area.
Now when the mouse enters the region, show the scrollbar, and when it exits the region, hide the scrollbar.
Ensure that you set the MinWidth on the invisible region, so that if the window gets narrow, the scrollbar trigger area is still wide enough to be usable.

Disable the "hover" scrolling effect of a scrolling menu and use a vertical scrollbar instead

How can I disable the default scrolling effect of a menu and just use a vertical scrollbar. I am able to use the scrollbar when I set overflowY to 'auto'. However, the mouse scroll wheel doesn't work as expected anymore, and the behavior in general is just wonky. I suspect it is because both scrolling is in effect and they are comflicting with each other.
I'm not sure if there is a config option that I am missing. The weird behavior can be seen here: Fiddle
Have you tried setting a height / maxHeight on the menu and setting overflowY:'scroll' ?
I'm working around this issue by simply embedding a panel with a fixed size as a menu item, and then adding all the components to the panel instead. This gives me a lot more flexibility to layout the items, and not have to worry about the inconsistent scrolling of an overflown menu.

How to change scrolling behaviour when resizing window in WPF/XAML

Research
Currently when working with WPF/XAML, the default scrolling behaviour for the scroll bar is that the VerticalScrollBarVisibility = Visible and the HorizontalScrollBarVisibility = Auto. This means the vertical scroll bar is always visible while the horizontal scroll bar is only visible is the content extends outside the width of the allocated area. Note that while the scrollbar is Visible, if the content do not extend beyong their allocated space, the scroll is deactivated and do not take any user input.
You may change this by changing the values to Visible, Auto, Hidden, or Disabled:
<ScrollViewer VerticalScrollBarVisibility="Visible"
HorizontalScrollBarVisibility = "Auto">
...
</ScrollViewer>
Problem
The problem is if you resize the window of the application and make it smaller, the scroll bars do not react as it should. It seems to just get cut off at the edges as I make the window smaller and smaller. The horizontal scrollbar is never activated. I then made the horizontal scrollbar visible just to see what happens. But it never changes to its active form when I make the windows smaller.
Can I assume that the scrollbar only activates when the content of the allocated space becomes to large for the space and not when the space is reduced when resizing the application window? If so does anyone know a way around this?
Edit
So I was working with my code and I realize that the scroll bar for the main window works as it should when the window is resized but that is not what I want. My main application window consists of three dock panels. Each of these panels needs to have its own scrollbars. It seems that when i resize the main window, the main window's scrollbars activate as appropriate but not the individual section's scrollbars. What I want to do is disable the main windows scroll bar altogether and have only the individual section's scrollbar work.

how to use orientation in scroll viewer like scrollbar

how to use orientation in scroll viewer like scrollbar
I'm not sure what exactly you are trying to do, but the ScrollViewer has two properties called ScrollViewer.HorizontalScrollBarVisibility and ScrollViewer.VerticalScrollBarVisibility which you can set to Auto, Hidden, Visible and Disabled.
So if you want to show the vertical or horizontal scrollbar of the ScrollViewer you can set one of them to Visible.

WPF - ScrollView Confusion

I am new to WPF and the ScrollViewer is frustrating me. Either I just don't "get" it, or it is a limited control.
Here are my Frustrations:
Bad Horizontal Scrolling The horizontal scroll bar is only visible at the bottom of the list (I have to scroll to the bottom to see it)
Bad Borders I have a ListBox in my ScrollViewer. When I start the bottom of the list has no border and when I scroll down, the top border (line) of the list box disappears. I can kind of understand this, but attempts to set BorderThickness or BorderBrush for the ScrollViewer result in no change (I wanted to use the ScrollViewer's border to keep a constatant box around the list contents, like most list boxes out in cyber world).
Bad Handling of Short Lists When the items in the list don't reach the bottom the ScrollViewer keeps the scroll bar there and just dithers it out. Why not free up some space and remove it?
Some of these may seem petty (and they are). But users expect a certain look and feel from their apps and WPF is making it hard to get this out of the box.
If you know a way to fix any of these I would love a response. If there is a better way to deal with scrolling than using the ScrollViewer that would aslo be welcome.
Maybe you see some scroll bar from inside the list rather than the scroll bar from the ScrollViewer? Try setting <ScrollViewer ... HorizontalScrollBarVisibility="Auto"> (default is Hidden, which means that no horizontal scroll bar is shown ever; also try "Visible" for the sake of debugging)
Is putting a <Border> around the ScrollViewer an option?
VerticalScrollBarVisibility has a default value of Visible. If you want the scroll bar to disappear when it is not necessary, try <ScrollViewer ... VerticalScrollBarVisibility="Auto">.

Resources