I have a form with a lot of small imageboxes.....how do I put scroll bars so whe
thanks in advance
[17 byte] By [
faisal664] at [2007-11-15 18:34:17]

# 1 Re: I have a form with a lot of small imageboxes.....how do I put scroll bars so whe
The following code should get you started.'Add a vertical ScrollBar to the form
Dim oldPos as Integer
private Sub Form_Load()
Dim iFullFormHeigth as Integer
Dim iDisplayHeight as Integer
'Change the values bellow to fit your need.
iFullFormHeigth = 6000
iDisplayHeight = 4000
me.Height = iDisplayHeight
With VScroll1
.Height = me.ScaleHeight
.Min = 0
.Max = iFullFormHeigth - iDisplayHeight
.SmallChange = Screen.TwipsPerPixelY * 5
.LargeChange = .SmallChange * 2
End With
End Sub
private Sub ScrollForm()
Dim ctl as Control
for Each ctl In me.Controls
If Not (TypeOf ctl is VScrollBar) And _
Not (TypeOf ctl is CommandButton) then
ctl.Top = ctl.Top + oldPos - VScroll1.Value
End If
next
oldPos = VScroll1.Value
End Sub
private Sub VScroll1_Change()
Call ScrollForm
End Sub
private Sub VScroll1_Scroll()
Call ScrollForm
End Sub
Help us improve our answers by rating them.
MKSa at 2007-11-10 0:33:44 >

# 2 Re: I have a form with a lot of small imageboxes.....how do I put scroll bars so whe
hi there,
you kinda saw my program im trying to make...has a list box and thumbnails to the right handside.....i am assuming that it would be better if I use a MDI rather then SDI because i dont want the list box scrolling down also.
right?
# 3 Re: I have a form with a lot of small imageboxes.....how do I put scroll bars so whe
I think you can continue with the design you have but make the appropriate changes.
Help us improve our answers by rating them.
MKSa at 2007-11-10 0:35:49 >

# 4 Re: I have a form with a lot of small imageboxes.....how do I put scroll bars so whe
I have something here:
http://www.dev-archive.com/cgi-bin/bbs/wt/showpost.pl?Board=vb&Number=81745&page=0&view=collapsed&sb=5
It may not answer your question 100% but I'm sure, it can give you idea manipulating scroll bars and images.
aio at 2007-11-10 0:36:47 >

# 5 Re: I have a form with a lot of small imageboxes.....how do I put scroll bars so whe
what is ifullformheight and idisplayheight?
i dont think i like scroll bars hehe
# 6 Re: I have a form with a lot of small imageboxes.....how do I put scroll bars so whe
ifullformheight is the real height of the form and idisplayheight is the form height you want to display. For the Vertical scrollbar to work the ifullformheight should be greater than idisplayheight. These heights are in twips. So for an 800x600 and if you have an oversized form, try idisplayheight=8500.
Help us improve our answers by rating them.
MKSa at 2007-11-10 0:38:47 >

# 7 Re: I have a form with a lot of small imageboxes.....how do I put scroll bars so whe
you know...I did put the scroll bar in the form. But I think I am getting my form height and display height messed up somewhere. And it seems to be acting funky.
this is the code that i currently have
option Explicit
Dim oldPos as Integer
private Sub Form_Load()
img_enlargepic.Move 0, 0
Dim iFullFormHeight as Integer
Dim iDisplayHeight as Integer
'Change the values bellow to fit your need.
iFullFormHeight = frm_enlargepic.Height + lbl_header.Height
iDisplayHeight = 3000
'me.Height = iDisplayHeight
With vsb_enlargepic
.Top = 0
'.Left = frm_enlargepic.Width
.Height = frm_enlargepic.ScaleHeight
.Min = 0
.Max = iFullFormHeight - iDisplayHeight
.SmallChange = Screen.TwipsPerPixelY * 5
.LargeChange = .SmallChange * 2
End With
End Sub
private Sub ScrollForm()
Dim ctl as Control
for Each ctl In me.Controls
If Not (TypeOf ctl is VScrollBar) And _
Not (TypeOf ctl is CommandButton) then
ctl.Top = ctl.Top + oldPos - vsb_enlargepic.Value
End If
next
oldPos = vsb_enlargepic.Value
End Sub
private Sub vsb_enlargepic_Change()
Call ScrollForm
End Sub
private Sub vsb_enlargepic_Scroll()
Call ScrollForm
End Sub
# 8 Re: I have a form with a lot of small imageboxes.....how do I put scroll bars so whe
Replace frm_enlargepic.Height + lbl_header.Height in
iFullFormHeight = frm_enlargepic.Height + lbl_header.Height
by the actual form height value that you get from the form properties. Check also that the ScaleMode is set to Twips.
Help us improve our answers by rating them.
MKSa at 2007-11-10 0:40:58 >

# 9 Re: I have a form with a lot of small imageboxes.....how do I put scroll bars so whe
'Several changes were made. Copy and paste the following code to the appropriate form.
option Explicit
Dim oldPos as Integer
private Sub Form_Activate()
img_enlargepic.Move 0, 0
oldPos = 0
Dim iFullFormHeight as Integer
Dim iDisplayHeight as Integer
'Change the values bellow to fit your need.
iFullFormHeight = img_enlargepic.Height
Change the following value if needed.
iDisplayHeight = 3000
me.ScaleHeight = iDisplayHeight
me.Width = img_enlargepic.Width + vsb_enlargepic.Width + 50
With vsb_enlargepic
.Top = 0
.Height = iDisplayHeight
.Left = me.ScaleWidth - .Width - 20
.Min = 0
.Max = iFullFormHeight - iDisplayHeight
.SmallChange = Screen.TwipsPerPixelY * 5
.LargeChange = .SmallChange * 2
End With
End Sub
private Sub ScrollForm()
Dim ctl as Control
If vsb_enlargepic.Value = vsb_enlargepic.Min then oldPos = 0
for Each ctl In me.Controls
If Not (TypeOf ctl is VScrollBar) And Not (TypeOf ctl is CommandButton) then
ctl.Top = ctl.Top + oldPos - vsb_enlargepic.Value
End If
next
oldPos = vsb_enlargepic.Value
End Sub
private Sub vsb_enlargepic_Change()
Call ScrollForm
End Sub
private Sub vsb_enlargepic_Scroll()
Call ScrollForm
End Sub
Help us improve our answers by rating them.
MKSa at 2007-11-10 0:41:57 >

