469,928 Members | 1,861 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,928 developers. It's quick & easy.

Getting TextBox scrollbar size

Hi,

Is there a way to:
1. Find out if a scrollbar is currently show on the TextBox
2. Get the width of the horizontal scrollbar

I am doing a UserControl with a TextBox with a small image placed in the upper right cornet of the
text box. If user typed a lot of text and scrollbar shows, i need to catch the event and move the
image left so that it will not be hidden by the scroll bar.

Any ideas would be highly appreciated!

Thank you,
Andrey
Nov 17 '05 #1
3 16968
"MuZZy" <le*******@yahoo.com> wrote in message
news:d6********************@comcast.com...
Hi,

Is there a way to:
1. Find out if a scrollbar is currently show on the TextBox
2. Get the width of the horizontal scrollbar

I am doing a UserControl with a TextBox with a small image placed in the
upper right cornet of the text box. If user typed a lot of text and
scrollbar shows, i need to catch the event and move the image left so that
it will not be hidden by the scroll bar.

Any ideas would be highly appreciated!


What properties have you got set on the textbox so that the scrollbar
appears automatically? I could only get it to either be there all the time
or never appear.

As for the width I think you can use

System.Windows.Forms.SystemInformation.VerticalScr ollBarWidth

Michael
Nov 17 '05 #2
Michael C wrote:
"MuZZy" <le*******@yahoo.com> wrote in message
news:d6********************@comcast.com...
Hi,

Is there a way to:
1. Find out if a scrollbar is currently show on the TextBox
2. Get the width of the horizontal scrollbar

I am doing a UserControl with a TextBox with a small image placed in the
upper right cornet of the text box. If user typed a lot of text and
scrollbar shows, i need to catch the event and move the image left so that
it will not be hidden by the scroll bar.

Any ideas would be highly appreciated!

What properties have you got set on the textbox so that the scrollbar
appears automatically? I could only get it to either be there all the time
or never appear.


TextBox.ScrollBars = Both/Horizontal/Vertical
When it's set to Both, it's automatic
As for the width I think you can use

System.Windows.Forms.SystemInformation.VerticalScr ollBarWidth
I will take a look, thank you!
Michael

Nov 17 '05 #3
"MuZZy" <le*******@yahoo.com> wrote in message
news:v-********************@comcast.com...
TextBox.ScrollBars = Both/Horizontal/Vertical
When it's set to Both, it's automatic


Don't know why but it's not automatic on my system. No matter what setting I
use the scrollbars just toggle between enabled and disabled. Maybe it's XP.

Michael
Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by pothik05 | last post: by
5 posts views Thread by MrNobody | last post: by
6 posts views Thread by tfs | last post: by
1 post views Thread by Olav Tollefsen | last post: by
3 posts views Thread by spielmann | last post: by
reply views Thread by d.steininger | last post: by
1 post views Thread by Flack | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.