RobinPerris / DarkUI

Dark themed control and docking library for .NET WinForms.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

darkScrollbar - How to link to listView ?

bascurtiz opened this issue · comments

First of all, thank you for creating this neat Dark UI Robin!

I've managed to make my Winforms just how I want it, except...
The scrollbar, see:
image

I've managed to setup Dark UI using your descriptions, and now it looks like this:
image

Super sweet!
But.... It's not connected to the listView I'm using there.

How do I link your darkScrollbar to listView?
Or how would I approach this?

commented

Are you using a DarkListView or the WinForms default ListView control?

If it's the former, DarkListView comes with its own in-built DarkScrollBar control so you shouldn't have to do anything.

If it's the latter, you'll actually have a bit of trouble. The default WinForms controls are very difficult to modify in this way.

I found this implementation by having a quick look around, but it's not pretty: https://www.codeproject.com/articles/236319/listview-with-custom-scrollbars-2

I would highly recommend using the DarkListView control or looking at how I implemented it and creating your own with similar behaviour.

@RobinPerris
I'm using WinForms default ListView control.
I've customized it to my likings using OwnerDraw, So I have control over how it shows (selection color bar, background, etc.)

With DarkListView I get an extra horizontal scrollbar, that I can't seem to get rid of.
There's no Property for it to disable either.
A hint would be much appreciated =)

commented

The control will check if the measured width of the inner content is greater than the maximum width of the overall control. If so, it'll force the scrollbar to appear.

private void SetScrollBarVisibility()
{
_vScrollBar.Visible = _visibleSize.Height < ContentSize.Height;
_hScrollBar.Visible = _visibleSize.Width < ContentSize.Width;
}

This is by design. If you would like to remove the horizontal scrollbar even if the inner content is greater in size, you would have to override this functionality manually. There is no on/off switch in the form of an exposed property.

Apologies, you're actually trying to do something I never thought of when designing this library.

If you're confident in modifying the DarkUI code yourself, you could add a property to DarkScrollBase and have this checked within the SetScrollBarVisibility method.

commented

Going to close this due to inactivity. If you're still trying to solve this problem, feel free to open a new issue and I'll help as much as I can.