|
-
Feb 1st, 2002, 07:36 AM
#1
Thread Starter
Addicted Member
control arrays
First of all I DON'T want to use a custom control
I have a picture box with a line in it
I want an array of picture boxes with one line control in each
when I load a new picture box and then a line control, the new line control is loaded into the first picture box
Code:
Private Sub Command1_Click()
Dim i As Integer
i = Picture1.Count
Load Picture1(i)
Picture1(i).Visible = True
Picture1(i).Top = Picture1(i - 1).Top + Picture1(0).Height
Load Line1(i)
Line1(i).Visible = True
'move teh new line a bit so you can see it
Line1(i).Y1 = Line1(i - 1).Y1 + 10
Line1(i).Y2 = Line1(i - 1).Y2 + 10
End Sub
How can I load a new line into the new picturebox?
Another light-hearted post from Guru 
-
Feb 1st, 2002, 07:54 AM
#2
Give this a try.
VB Code:
Private Sub Command1_Click()
Dim i As Integer
i = Picture1.Count
Load Picture1(i)
Picture1(i).AutoRedraw = True
Picture1(i).Visible = True
Picture1(i).Top = Picture1(i - 1).Top + Picture1(0).Height
Picture1(i).Line (Line1.X1, Line1.Y1)-(Line1.X2, Line1.Y2)
End Sub
Don't make the line part of an array.
-
Feb 1st, 2002, 08:00 AM
#3
Thread Starter
Addicted Member
Sorry , perhaps I should have added that It has to be a line control.
line method is not suitable
Thanks anyway!
Another light-hearted post from Guru 
-
Feb 1st, 2002, 01:34 PM
#4
Well heres the code if you have to use it as part of an array
VB Code:
Option Explicit
Private Sub Command1_Click(Index As Integer)
Dim i As Integer
i = Picture1.Count
Load Picture1(i)
With Picture1(i)
.AutoRedraw = True
.Top = Picture1(i - 1).Top + Picture1(0).Height
.Visible = True
End With
Load Line1(i)
With Line1(i)
Set .Container = Picture1(i)
.X1 = Line1(0).X1
.Y1 = Line1(0).Y1
.X2 = Line1(0).X2
.Y2 = Line1(0).Y2
.Visible = True
End With
End Sub
-
Feb 2nd, 2002, 03:50 PM
#5
Thread Starter
Addicted Member
Perfect!
Thanks MarkT
I never realised you could set the container.
Another light-hearted post from Guru 
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
|