How do you dock a horizontal and verticle scroll bar control in the standard fashion?

This should be easy but I can not figure it out. I have a horizontal and verticle scroll bar control docked in the standard locations but can not get the little "square" area in the lower right corner. Instead, the arrow portion of one of the scroll bars will be in the corner instead. Other than hard coding them, does anybody know a quick way to get these to dock so that there is a blank square area in the lower right corner? Thanks in advance!
LVL 5
Amfab SteelAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonMiddle School Assistant TeacherCommented:
Why are you using the ScrollBar controls manually?

Try setting the AutoScroll() property of your form to True.  The scrollbars will appear automatically when they are needed (if anything is outside the viewable area of your form).
0
Amfab SteelAuthor Commented:
I don't need to scroll the controls on a form so AutoScroll doesn't apply to my situation. The scroll bars are used to programatically "scroll" the output of vector data onto a stationary picturebox control.
0
SanclerCommented:
It depends what you mean by "Other than hard coding them".  Here's a sub I've used

    Private Sub doScrollBars()
        With vsb
            .Top = 0
            .Left = Me.ClientSize.Width - .Width
            .Height = Me.ClientSize.Height - hsb.Height
        End With
        With hsb
            .Top = Me.ClientSize.Height - .Height
            .Left = 0
            .Width = Me.ClientSize.Width - vsb.Width
        End With
    End Sub

The VerticalScrollBar (vsb) is anchored Right, the HorizontalSCrollBar (hsb) is anchored Bottom, and the sub is called in the Form's Load and Resize subs.

Roger
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Amfab SteelAuthor Commented:
Thanks for your comment Sancler. That is what I am planning to do if I can't find a way to use the built in docking feature. I would like to use the built in docking functionality in VB.NET so I don't have to manually resize the other controls like the picture box etc. I've loved not having to manually resize any controls in VB.NET and am getting VB 6.0 flashbacks now that I might have to do it programatically.
0
SanclerCommented:
I don't think you can do it with .Dock, but you can with .Anchor.  Here's the sub revised

    Private Sub doScrollBars()
        With vsb
            .Top = 0
            .Left = Me.ClientSize.Width - .Width
            .Height = Me.ClientSize.Height - hsb.Height
            .Anchor = AnchorStyles.Bottom Or AnchorStyles.Right Or AnchorStyles.Top
        End With
        With hsb
            .Top = Me.ClientSize.Height - .Height
            .Left = 0
            .Width = Me.ClientSize.Width - vsb.Width
            .Anchor = AnchorStyles.Bottom Or AnchorStyles.Left Or AnchorStyles.Right
        End With
    End Sub

It would only need calling on Form Load.  

Or, if you want to set the sizes visually at design time retaining the clear square in the bottom right hand corner, you could also set the .Anchor values at design time.

Roger
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Amfab SteelAuthor Commented:
Good enough for me. Thanks Roger!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.