|
-
Apr 2nd, 2002, 11:04 AM
#1
Thread Starter
Member
Scroll Bar Position??
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?
-
Apr 2nd, 2002, 11:10 AM
#2
Bouncy Member
are you using a Vertical Scrollbar control??
if so do this:
VB Code:
VScroll1.Left = Me.ScaleWidth - 200
-
Apr 2nd, 2002, 11:16 AM
#3
PowerPoster
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
-
Apr 2nd, 2002, 12:24 PM
#4
Thread Starter
Member
Scroll Bar Position
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
-
Apr 2nd, 2002, 12:34 PM
#5
PowerPoster
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
-
Apr 3rd, 2002, 03:34 AM
#6
Bouncy Member
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.
VB Code:
Command1.Move 0, 0, 1000, 1000
it will be about 4 times quicker than
VB Code:
Command1.Left = 0
Command1.Top= 0
Command1.Width = 1000
Command1.Height = 1000
-
Apr 3rd, 2002, 03:38 AM
#7
PowerPoster
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.
-
Apr 3rd, 2002, 03:51 AM
#8
Bouncy Member
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.
-
Apr 3rd, 2002, 03:53 AM
#9
PowerPoster
oooh... I didn't know that.
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|