-
February 1st, 2001, 06:37 AM
#1
Scroll bar must size to Windows settings
I use a scroll bar. But it has always the same size. I want it to have the right size which is chosen in the Windows settings.
Can someone tell me how to do this, or where in the registry I can find the correct size?
Thanks.
Peter Moor
-
February 1st, 2001, 09:37 AM
#2
Re: Scroll bar must size to Windows settings
I think all you need is some resize code, paste this into your form and as you move the form it will always keep the scroll bar the right size.
private Sub Form_Resize()
on error resume next
If me.WindowState = vbMinimized then Exit Sub
VScroll1.Move me.ScaleWidth - VScroll1.Width, 0, VScroll1.Width, me.ScaleHeight
End Sub
-
February 1st, 2001, 10:51 AM
#3
Re: Scroll bar must size to Windows settings
Form1; to test, change window sheme to e.g. "Rainy Day" and click on form.
option Explicit
private Declare Function GetSystemMetrics Lib "user32" (byval nIndex as Long) as Long
private Const SM_CXVSCROLL = 2
private Const SM_CYHSCROLL = 3
private Sub Form_Click()
' resize controls
Controls!vsb1.Width = ScaleX(GetSystemMetrics(SM_CXVSCROLL), vbPixels)
Controls!hsb1.Height = ScaleX(GetSystemMetrics(SM_CYHSCROLL), vbPixels)
print "vert. scrollbar width:" & GetSystemMetrics(SM_CXVSCROLL) & " pixels"
print "horz. scrollbar height:" & GetSystemMetrics(SM_CYHSCROLL) & " pixels"
End Sub
private Sub Form_Load()
With Controls.Add("vb.vscrollbar", "vsb1")
.Width = 500
.Left = 2400
.Visible = true
End With
With Controls.Add("vb.hscrollbar", "hsb1")
.Height = 500
.Left = 3000
.Visible = true
End With
End Sub
-
February 1st, 2001, 01:10 PM
#4
Re: Scroll bar must size to Windows settings
Actually that was not what I meant, but thanks anyway.
Peter Moor
-
February 18th, 2001, 09:05 AM
#5
Now with statusbars
I don't know if the size of statusbars can also be configured by Windows, but if it does, can I use this way to get that size too?
Peter Moor
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
|