The background: Most of us know the SysListView32
common control and the equivalent wrapper ListView
class provided by the .NET Framework. A little depth into its internals show that the scroll bars it provides for scrolling its contents are NOT controls themselves, but are managed by the SysListView32
control.
The goal: Always draw scroll bars even if it has no ListViewItems
to display or has very few such that no scroll bars are needed anyway; sort of like mimicking the RichTextBox
class with its ScrollBars
property set to ForcedBoth
. Or kinda like this ListBox
:
The descriptive image:
The long awaited actual question:
How do I force scroll bars to always be Visible
within a ListView
irrespective of the number of ListViewItems
and disable them if they are unnecessary, at the same time avoiding size miscalculation (to display collapse buttons of the ListViewGroup
s) and theme deterioration?
Answers without code, and answers with code in C#, VB.NET and C++/CLR are welcome. If you post code in any other language supported by .NET, please also leave a link to a code conversion website I may use if the code seems, uh, incomprehensible.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…