Results 1 to 3 of 3

Thread: Move a label vertically downwards on a form

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Posts
    9

    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

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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:
    1. With origin.ldate(n)
    2.                 .Left = origin.lday(n Mod 7).Left
    3.                 .Top = origin.ldate(0).Top + (origin.ldate(0).Height * (n \ 7))
    4.                 If .Top + .Height > origin.Height - 100 Then .Top = origin.ldate(0).Top
    5.                 If m = Format(d, "mm") Then .Visible = True
    6.                 .Caption = Format(d, "d ")
    7.                 .Tag = d
    8.                 .Visible = True
    9.  
    10.             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

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Posts
    9

    Re: Move a label vertically downwards on a form

    thanks i'll give it a go

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width