Amfab Steel
asked on
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!
ASKER
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.
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
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
ASKER
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Good enough for me. Thanks Roger!
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).