Resolved DatagriView with different ScrollBar Control

giodepa

Member
Joined
Nov 23, 2021
Messages
17
Programming Experience
1-3
Hi all,
I found from Nuget DarkUI package where there are several controls like DarkScrollBar.
So I decided to use use this control and to bind my DataGridView with this new DarkScrollBar control.

First step.
I added DataGridView1 inside a Panel panel1.

Second step.
I disabled DataGridView ScrollBar control
DataGridView1.ScrollBars=ScrollBars.None;

Now I don't know how to proceed in order to bind DataGridView1 with DarkScrollBar DarkScrollBar1.

How can I do this?
Thank in advanced
gio
 
Hi John
your suggestion works perfectly!!!
THX
I added it inside darkScrollBar1_ValueChanged method.
Only strange aspect is when scrollBar is showed for first time: the length is different than one I move mouse or click on it:
2023-11-13_09-24-38.jpg


thanks again
gio
 
I set it in grid2_Scroll method as
C#:
dgv.Rows.GetRowCount(DataGridViewElementStates.Displayed) - 1;
returns 0 after command
C#:
dgv.DataSource = Tadj;
Moreover I set
C#:
darkScrollBar1.ViewSize=dgv.Rows.GetRowCount(DataGridViewElementStates.Displayed)-1;
in dgv_RowPostPaint to solve issue in picture above.
 
You can use DataBindingComplete event.
 
Back
Top Bottom