sirbounty
asked on
Help with control array positioning
I want these labels to be laid out 'as close together' as would appear pleasing to the eye.
I also don't want them to extend off the side of the form.
Having a bit of trouble with the logic on the second line of labels...
Here's the relevant code
Load lblData(x)
With lblData(x)
If x = 7 Then 'This is the 'first' of these labels (there are obviously 7 others, but they're static)
intTop = 2665 'The first label's top
intLeft = 280 'The first label's left
Else
intLeft = lblData(x - 1).Left + lblData(x - 1).Width + 100 'Otherwise - add the left & width to 100 to get the 'new' left (this could use some tweaking, I'd wager)
If intLeft > 6500 Then 'If left is 'dangerously' close to the form's edge, then change the 'top' and reset the 'left' (obviously the left would be okay, but though it's 'unlikely' to have more than 2 rows, I want to give the option for at least 3...
intTop = 3065
intLeft = 280
Else
intTop = 2665
intLeft = lblData(x - 1).Left + lblData(x - 1).Width + 100
End If
End If
.Caption = txtData(1).Text
.Width = 1000
.Height = 255
.Top = intTop
.Left = intLeft
.Visible = True
End With
I also don't want them to extend off the side of the form.
Having a bit of trouble with the logic on the second line of labels...
Here's the relevant code
Load lblData(x)
With lblData(x)
If x = 7 Then 'This is the 'first' of these labels (there are obviously 7 others, but they're static)
intTop = 2665 'The first label's top
intLeft = 280 'The first label's left
Else
intLeft = lblData(x - 1).Left + lblData(x - 1).Width + 100 'Otherwise - add the left & width to 100 to get the 'new' left (this could use some tweaking, I'd wager)
If intLeft > 6500 Then 'If left is 'dangerously' close to the form's edge, then change the 'top' and reset the 'left' (obviously the left would be okay, but though it's 'unlikely' to have more than 2 rows, I want to give the option for at least 3...
intTop = 3065
intLeft = 280
Else
intTop = 2665
intLeft = lblData(x - 1).Left + lblData(x - 1).Width + 100
End If
End If
.Caption = txtData(1).Text
.Width = 1000
.Height = 255
.Top = intTop
.Left = intLeft
.Visible = True
End With
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Works up until item 2 on line 2...
ASKER
Ok - made intTop a form variable and it's working.
Thanx.
Thanx.
At this line
If intLeft > 6500 Then
intTop = 3065
intLeft = 280
Else
change intTop to something like
intTop = intTop + 400
Leo