Hack Forums
[.NET] datagridview Scroll width color - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] datagridview Scroll width color (/showthread.php?tid=5753958)



datagridview Scroll width color - monemds - Nov 17, 2017

i want to change both Scroll bars colors and width  with datagridview


RE: datagridview Scroll width color - NinjaLeaks - Nov 17, 2017

5 seconds with google got me this --> https://www.codeproject.com/Messages/3259958/Re-Changing-the-colour-of-scroll-bar.aspx
I never really done it but looking at that post the code should work.
Gl


RE: datagridview Scroll width color - monemds - Nov 17, 2017

i convert c# to vb.net

the code not work

the code became
 

Code
Private Sub foo()
       Dim g = New DataGridView()
       ToString()
       g.Controls(0).BackColor = Color.Red
   End Sub
 

   Private Sub DataGridView1_Scroll(ByVal sender As Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles DataGridView1.Scroll
       foo()
       ' g.Controls(0).BackColor = Color.Red
   End Sub
End Class

Public NotInheritable Class Util
   Private Sub New()
   End Sub
   Public Shared Function Find(Of T As Control)(ByVal container As Control) As T
       For Each child As Control In container.Controls
           Return (If(TypeOf child Is T, DirectCast(child, T), Find(Of T)(child)))
       Next
       ' Not found.
       Return Nothing
   End Function
End Class