How to Increse width of Vertical ScrollBar
-
Hello, Is there any way that one can increse width of a Vertical ScrollBar of DataGridView in Visual Studio 2005 ? This feature was there in Visual Studio .NET 2003. Code from VS 2003 :
If grd.Controls(1).Width < 28 Then
grd.Controls(1).Width += increaseWidth
End Ifbut it wont work in VS 2005. Looking forward to Reply. Thanking you in advance.
-
Hello, Is there any way that one can increse width of a Vertical ScrollBar of DataGridView in Visual Studio 2005 ? This feature was there in Visual Studio .NET 2003. Code from VS 2003 :
If grd.Controls(1).Width < 28 Then
grd.Controls(1).Width += increaseWidth
End Ifbut it wont work in VS 2005. Looking forward to Reply. Thanking you in advance.
Hi, Try the following code: _______________________________________________________________________________ Public Class CustomDataGrid Inherits DataGrid Public Sub New() ' make scrollbar visible & add handler VertScrollBar.Visible = True AddHandler VertScrollBar.VisibleChanged, AddressOf ShowScrollBars End Sub Private ReadOnly CAPTIONHEIGHT As Integer = 21 Private ReadOnly BORDERWIDTH As Integer = 2 Private Sub ShowScrollBars(ByVal sender As Object, ByVal e As EventArgs) If Not VertScrollBar.Visible Then Dim width As Integer = VertScrollBar.Width VertScrollBar.Location = _ New Point(ClientRectangle.Width - width - BORDERWIDTH, CAPTIONHEIGHT) VertScrollBar.Size = _ New Size(width, ClientRectangle.Height - CAPTIONHEIGHT - BORDERWIDTH) VertScrollBar.Show() End If End Sub End Class _______________________________________________________________________________ I hope this would be helpful.
Vinay ComponentOne LLC. www.componentone.com
-
Hi, Try the following code: _______________________________________________________________________________ Public Class CustomDataGrid Inherits DataGrid Public Sub New() ' make scrollbar visible & add handler VertScrollBar.Visible = True AddHandler VertScrollBar.VisibleChanged, AddressOf ShowScrollBars End Sub Private ReadOnly CAPTIONHEIGHT As Integer = 21 Private ReadOnly BORDERWIDTH As Integer = 2 Private Sub ShowScrollBars(ByVal sender As Object, ByVal e As EventArgs) If Not VertScrollBar.Visible Then Dim width As Integer = VertScrollBar.Width VertScrollBar.Location = _ New Point(ClientRectangle.Width - width - BORDERWIDTH, CAPTIONHEIGHT) VertScrollBar.Size = _ New Size(width, ClientRectangle.Height - CAPTIONHEIGHT - BORDERWIDTH) VertScrollBar.Show() End If End Sub End Class _______________________________________________________________________________ I hope this would be helpful.
Vinay ComponentOne LLC. www.componentone.com
Hello Vinay, I am having the same problem. I can increse the width of Datagrid Vertical Scrollbar in VS.NET 2003. But now in VS.NET 2005, I want to use DataGridView and it does not support the same code of .NET 2003. Code of .NET 2003 is as follows:
If grd.Controls(1).Width < 28 Then grd.Controls(1).Width = 30 End If
Also, in the code provided by you, You used "Inherits DataGrid" not DataGridview. So, I just wanted to know that will it work for Datagridview. Looking forward to your reply. Thanking You.- Milind Bhadane. Sr. Software Developer.