How do I go about moving a vertical and horizontal scroll bar. I want to move them in from the border of the form...towards the center. (About a centimeter) Any suggestions?
Printable View
How do I go about moving a vertical and horizontal scroll bar. I want to move them in from the border of the form...towards the center. (About a centimeter) Any suggestions?
are you using a Vertical Scrollbar control??
if so do this:
VB Code:
VScroll1.Left = Me.ScaleWidth - 200
:)
If you always want it to be in proportion you can use a percentage instead of a hard coded number.
VB Code:
' 5% from right border VScroll1.Left = 0.95 * Me.ScaleWidth - vscroll1.width
I was wondering if scroll bars automatically move to the edges of your form during runtime...Regardless of the monitor size or resolution.
Basically, would the scroll bars on my screen(17") be in the same position of the form as they would on a 14" screen.
Thanx
Controls on forms don't automatically size. You have to use the resize event of the form. Do this. Create a form with a text box (text1) and a command button (command1).
Past this code in the form resize event and play with resizing the form. This gets really complicated when you have a lot of controls. That's why it's best to use percentages if you really want everything to resize.
VB Code:
Sub Form1_Resize Const iBorder as integer =180 with Command1 .left = scalewidth - (.width + iBorder) .top = scaleheight - (.height + iBorder) end with with Text1 .left = iBorder .top = iBorder .width = scalewidth - (.left + iBorder) .height = scaleheight - (command1.height + 2 * iBorder) end with End Sub
TIP:
if you're going to be changing more than one Left, Top, Width or Height value of a control, then use the Move method instead.
i.e.it will be about 4 times quicker thanVB Code:
Command1.Move 0, 0, 1000, 1000
VB Code:
Command1.Left = 0 Command1.Top= 0 Command1.Width = 1000 Command1.Height = 1000
;)
I'm sure it is, that's how all my old code is written and it happens in an extremely small fraction of a blink. I've started using Move for new code though.
:DQuote:
Originally posted by cafeenman
I'm sure it is, that's how all my old code is written and it happens in an extremely small fraction of a blink. I've started using Move for new code though.
you're right it doesnt usually make any difference, just that the form's paint event fires each time you change one of the properties or use the Move event.
oooh... I didn't know that.
Thanks.