Hi,
I am dynamically loading a control array of textboxes into a picturebox. My problem is when I start to scroll down I loose the subsequent textboxes that aren't visible before you have to start scrolling. Any ideas???
Thanks in advance!
Printable View
Hi,
I am dynamically loading a control array of textboxes into a picturebox. My problem is when I start to scroll down I loose the subsequent textboxes that aren't visible before you have to start scrolling. Any ideas???
Thanks in advance!
are you resizing the picture box as you add controls?
here's a VERY rough example
Code:
Option Explicit
Private Sub Form_Load()
Dim i As Integer
For i = 1 To 10
Load Text1(i)
Text1(i).Top = Text1(i - 1).Top + 460
Text1(i).Visible = True
Picture1.Height = Picture1.Height + 460
Next i
VScroll1.Max = Picture1.Height
End Sub
Private Sub VScroll1_Scroll()
Picture1.Top = -VScroll1.Value
End Sub
I think I got this here somewhere...wish I could give credit to the author...
Code:'Place a Timer on the Form and a Label inside a Picturebox Control....
Private Sub Form_Load()
Label1 = "Scrolly Thing.." & vbCrLf & vbCrLf & _
"Line1" & vbCrLf & _
"Line2" & vbCrLf & _
"Line3" & vbCrLf & _
"Line4"
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
Static sLastTag As String
Static YPos As Long
If Label1 <> sLastTag Then
Label1.AutoSize = True
sLastTag = Label1
Picture1.ScaleMode = vbPixels
YPos = Picture1.ScaleHeight
Label1.Left = (Picture1.ScaleWidth - Label1.Width) / 2
End If
If YPos > -Picture1.TextHeight(sLastTag) Then
YPos = YPos - 3
Else
YPos = Picture1.ScaleHeight
End If
Label1.Top = YPos
End Sub