DataGrid Slider Bar

  • Thread starter Thread starter JT
  • Start date Start date
J

JT

Is there a way to hide the horizontal slider bar that
appears at the bottom of a datagrid? I have set
navigation to false, but all this did was disable the
slider, not hide it.
Thanks.
JT
 
Resize or hide the columns with styles collection so there is no need of
showing the slider bar.
 
Hi JT,
The datagrid control will show/hide the scrollbar automaticlly on the
width of your data columns.
and this is the default behaviour of datagrid, so it's not easy to change
it.
And I'm wondering why you want to hide the horizontal scrollbar of the
datagrid?
Maybe we can try other ways to let the scrollbar not shown.

Thanks!




Kind regards,

Ying-Shen Yu [MS]
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. 2001 Microsoft Corporation. All rights
reserved.
--------------------
| Content-Class: urn:content-classes:message
| From: "JT" <[email protected]>
| Sender: "JT" <[email protected]>
| Subject: DataGrid Slider Bar
| Date: Tue, 9 Sep 2003 13:41:57 -0700
| Lines: 6
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcN3Es/fz/eXFZfJQO6VTAFWQTtIgA==
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:51976
| NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| Is there a way to hide the horizontal slider bar that
| appears at the bottom of a datagrid? I have set
| navigation to false, but all this did was disable the
| slider, not hide it.
| Thanks.
| JT
|
 
Thanks to you both. My datagrid is a little unusual in
that it clears the tablestyle of the designer datagrid and
adds a custom table style on form load. The custom table
style has a width LESS than the 'container' designer
grid. Nevertheless, the slider appears. If I slightly
tweak the width of any of the datacolumns once the form is
loaded, the slider disappears and does not return. Any
further advice would be appreciated. The reason that I
want to hide this slider is mostly for aesthetics, but
also because it is unnecessary.
JT
 
Hi JT,
Thanks for your detail description, My understanding of your problem
is, your width of the columns is just as same as or a little less than the
width of the DataGrid, then the DataGrid shows the horizontal scrollbar
automatically.
As far as I know, We have little way to hide the scrollbar. However,
we can adjust the width of your columns
and leave two grid units for the vertical scrollbar. or you may also
enlarge your datagrid width by two grid units(this way maybe simpler but
depends on your UI Design). And If your data lings are not long enough to
show the vertical scroll bar you will find the empty space beside the
right column. I think you can change columnwidth of the right column after
filling the dataset by checking if there is an vertical scrollbar ( you can
use GetChildAtPoint method to check a fix point, or check this by the row
count).

Thanks, If you have any questions on this issue, please let me know!




Best regards,

Ying-Shen Yu [MS]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Content-Class: urn:content-classes:message
| From: "JT" <[email protected]>
| Sender: "JT" <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: RE: DataGrid Slider Bar
| Date: Wed, 10 Sep 2003 08:01:38 -0700
| Lines: 74
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcN3rG+bsNFt/L0UQ5qMrY5rVUXfhQ==
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:52046
| NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| Thanks to you both. My datagrid is a little unusual in
| that it clears the tablestyle of the designer datagrid and
| adds a custom table style on form load. The custom table
| style has a width LESS than the 'container' designer
| grid. Nevertheless, the slider appears. If I slightly
| tweak the width of any of the datacolumns once the form is
| loaded, the slider disappears and does not return. Any
| further advice would be appreciated. The reason that I
| want to hide this slider is mostly for aesthetics, but
| also because it is unnecessary.
| JT
| >-----Original Message-----
| >Hi JT,
| > The datagrid control will show/hide the scrollbar
| automaticlly on the
| >width of your data columns.
| >and this is the default behaviour of datagrid, so it's
| not easy to change
| >it.
| >And I'm wondering why you want to hide the horizontal
| scrollbar of the
| >datagrid?
| >Maybe we can try other ways to let the scrollbar not
| shown.
| >
| >Thanks!
| >
| >
| >
| >
| >Kind regards,
| >
| >Ying-Shen Yu [MS]
| >Microsoft Support Engineer
| >
| >This posting is provided "AS IS" with no warranties, and
| confers no rights.
| >You assume all risk for your use. 2001 Microsoft
| Corporation. All rights
| >reserved.
| >--------------------
| >| Content-Class: urn:content-classes:message
| >| From: "JT" <[email protected]>
| >| Sender: "JT" <[email protected]>
| >| Subject: DataGrid Slider Bar
| >| Date: Tue, 9 Sep 2003 13:41:57 -0700
| >| Lines: 6
| >| Message-ID: <[email protected]>
| >| MIME-Version: 1.0
| >| Content-Type: text/plain;
| >| charset="iso-8859-1"
| >| Content-Transfer-Encoding: 7bit
| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| >| Thread-Index: AcN3Es/fz/eXFZfJQO6VTAFWQTtIgA==
| >| Newsgroups:
| microsoft.public.dotnet.framework.windowsforms
| >| Path: cpmsftngxa06.phx.gbl
| >| Xref: cpmsftngxa06.phx.gbl
| >microsoft.public.dotnet.framework.windowsforms:51976
| >| NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
| >| X-Tomcat-NG:
| microsoft.public.dotnet.framework.windowsforms
| >|
| >| Is there a way to hide the horizontal slider bar that
| >| appears at the bottom of a datagrid? I have set
| >| navigation to false, but all this did was disable the
| >| slider, not hide it.
| >| Thanks.
| >| JT
| >|
| >
| >.
| >
|
 
A little trick I discovered is this... Add a Command button in your form and place the following line of code in the event

DataGrid1.Controls(0).Height = 0

Control 0 is the HScrollBar. You can't set its visible property to false. However IF you set the Height of the scrollbar to 0 then it pretty much has the same effect as it not being there...

You will have to try this code in some different events, and anytime the grid is reinitalized teh height will be reset to default, so you will have to put the code where it will do the most
good (Perhaps a paint event?)

Scot Rose, MCSD
Microsoft Visual Basic Developer Support
Email : (e-mail address removed) <Remove word online. from address>

This posting is provided “AS IS”, with no warranties, and confers no rights.




--------------------
Content-Class: urn:content-classes:message
From: "JT" <[email protected]>
Sender: "JT" <[email protected]>
References: <[email protected]> <[email protected]>
Subject: RE: DataGrid Slider Bar
Date: Wed, 10 Sep 2003 08:01:38 -0700
Lines: 74
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcN3rG+bsNFt/L0UQ5qMrY5rVUXfhQ==
Newsgroups: microsoft.public.dotnet.framework.windowsforms
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.windowsforms:52046
NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms

Thanks to you both. My datagrid is a little unusual in
that it clears the tablestyle of the designer datagrid and
adds a custom table style on form load. The custom table
style has a width LESS than the 'container' designer
grid. Nevertheless, the slider appears. If I slightly
tweak the width of any of the datacolumns once the form is
loaded, the slider disappears and does not return. Any
further advice would be appreciated. The reason that I
want to hide this slider is mostly for aesthetics, but
also because it is unnecessary.
JT
-----Original Message-----
Hi JT,
The datagrid control will show/hide the scrollbar automaticlly on the
width of your data columns.
and this is the default behaviour of datagrid, so it's not easy to change
it.
And I'm wondering why you want to hide the horizontal scrollbar of the
datagrid?
Maybe we can try other ways to let the scrollbar not shown.

Thanks!




Kind regards,

Ying-Shen Yu [MS]
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. 2001 Microsoft Corporation. All rights
reserved.
--------------------
| Content-Class: urn:content-classes:message
| From: "JT" <[email protected]>
| Sender: "JT" <[email protected]>
| Subject: DataGrid Slider Bar
| Date: Tue, 9 Sep 2003 13:41:57 -0700
| Lines: 6
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcN3Es/fz/eXFZfJQO6VTAFWQTtIgA==
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:51976
| NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| Is there a way to hide the horizontal slider bar that
| appears at the bottom of a datagrid? I have set
| navigation to false, but all this did was disable the
| slider, not hide it.
| Thanks.
| JT
|

.
 
Thank you both. Setting the control height to zero as I
configure my datagrid at runtime did the trick
beautifully. Thanks again.
JT
-----Original Message-----
A little trick I discovered is this... Add a Command
button in your form and place the following line of code
in the event
DataGrid1.Controls(0).Height = 0

Control 0 is the HScrollBar. You can't set its visible
property to false. However IF you set the Height of the
scrollbar to 0 then it pretty much has the same effect as
it not being there...
You will have to try this code in some different events,
and anytime the grid is reinitalized teh height will be
reset to default, so you will have to put the code where
it will do the most
good (Perhaps a paint event?)

Scot Rose, MCSD
Microsoft Visual Basic Developer Support
Email : (e-mail address removed) <Remove word online. from address>

This posting is provided "AS IS", with no warranties, and confers no rights.




--------------------
Content-Class: urn:content-classes:message
From: "JT" <[email protected]>
Sender: "JT" <[email protected]>
References: <[email protected]>
Subject: RE: DataGrid Slider Bar
Date: Wed, 10 Sep 2003 08:01:38 -0700
Lines: 74
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcN3rG+bsNFt/L0UQ5qMrY5rVUXfhQ==
Newsgroups: microsoft.public.dotnet.framework.windowsforms
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.windowsforms:52046
NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms

Thanks to you both. My datagrid is a little unusual in
that it clears the tablestyle of the designer datagrid and
adds a custom table style on form load. The custom table
style has a width LESS than the 'container' designer
grid. Nevertheless, the slider appears. If I slightly
tweak the width of any of the datacolumns once the form is
loaded, the slider disappears and does not return. Any
further advice would be appreciated. The reason that I
want to hide this slider is mostly for aesthetics, but
also because it is unnecessary.
JT
-----Original Message-----
Hi JT,
The datagrid control will show/hide the scrollbar automaticlly on the
width of your data columns.
and this is the default behaviour of datagrid, so it's not easy to change
it.
And I'm wondering why you want to hide the horizontal scrollbar of the
datagrid?
Maybe we can try other ways to let the scrollbar not shown.

Thanks!




Kind regards,

Ying-Shen Yu [MS]
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties,
and
confers no rights.
You assume all risk for your use. 2001 Microsoft Corporation. All rights
reserved.
--------------------
| Content-Class: urn:content-classes:message
| From: "JT" <[email protected]>
| Sender: "JT" <[email protected]>
| Subject: DataGrid Slider Bar
| Date: Tue, 9 Sep 2003 13:41:57 -0700
| Lines: 6
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcN3Es/fz/eXFZfJQO6VTAFWQTtIgA==
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:51976
| NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| Is there a way to hide the horizontal slider bar that
| appears at the bottom of a datagrid? I have set
| navigation to false, but all this did was disable the
| slider, not hide it.
| Thanks.
| JT
|

.


.
 
Back
Top