Results 1 to 4 of 4

Thread: Align Labels on a form

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2003
    Location
    Newark-on-trent, Nottingham
    Posts
    243

    Align Labels on a form

    Hi,

    I have set my form to be maximized on the screen on load and i have a label which on my screen resolution is centered.

    How do i get this label to be centered on the form no matter what the screen resolution of the user.

    There is no align property for a lable in vb6 that i can find.

    Many Thanks

    Steve

  2. #2
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Align Labels on a form

    VB Code:
    1. Private Sub Form_Resize()
    2.     Label1.Left = Me.ScaleWidth / 2 - Label1.Width / 2
    3. End Sub

  3. #3
    Lively Member
    Join Date
    Aug 2006
    Posts
    69

    Re: Align Labels on a form

    or for the center of screen...try this

    Label1.Left = (Screen.Width - Label1.Width) / 2
    Label1.Height = (Screen.Height - Label1.Height) / 2

  4. #4
    Lively Member
    Join Date
    Aug 2006
    Posts
    69

    Re: Align Labels on a form

    or for the center of screen...try this

    Label1.Left = (Screen.Width - Label1.Width) / 2
    Label1.Top = (Screen.Height - Label1.Height) / 2 .....sorry...wrong code

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