|
-
Feb 2nd, 2005, 07:16 AM
#1
Thread Starter
New Member
Move a label vertically downwards on a form
simple problem
I want to create a chessboard composed of labels, this works fine for the top row, but how do i employ the move function to move onto the next line
Private Sub Form_Load()
board.Width = 8000
board.Height = 8000
Dim c, lcount As Integer
Dim col As Boolean
For c = 1 To 7 ' do horizontal
Load lblsquare(c)
lcount = lcount + 1
If col = False Then ' for colour
lblsquare(c).BackColor = vbWhite
col = True
Else: col = False
End If
lblsquare(c).Height = (board.Height / 8) 'put square in correct position
lblsquare(c).Width = (board.Width / 8)
lblsquare(c).Move c * 1000
lblsquare(c).Visible = True
Next c
End Sub
-
Feb 2nd, 2005, 07:27 AM
#2
Re: Move a label vertically downwards on a form
you can load the whole board in one loop useing the Mod function to return that it is on the next line
your command to set the next row would be
VB Code:
With origin.ldate(n)
.Left = origin.lday(n Mod 7).Left
.Top = origin.ldate(0).Top + (origin.ldate(0).Height * (n \ 7))
If .Top + .Height > origin.Height - 100 Then .Top = origin.ldate(0).Top
If m = Format(d, "mm") Then .Visible = True
.Caption = Format(d, "d ")
.Tag = d
.Visible = True
End With
this was for a calander loaded labels 7 x 5 , so if you change the Mod 7 and \7 to 8 it should make your board
-
Feb 2nd, 2005, 07:37 AM
#3
Thread Starter
New Member
Re: Move a label vertically downwards on a form
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
|