Results 1 to 4 of 4

Thread: [2005] AutoSize Property

  1. #1

    Thread Starter
    Hyperactive Member Troy Lundin's Avatar
    Join Date
    May 2006
    Posts
    489

    [2005] AutoSize Property

    I have a label whose AutoSize Property is set to true. It's size inside the IDE is {64, 13}. It's size at runtime is {64, 18}. I do not have any code that is changing is Size property or it's AutoSize property.

    I am wondering why this is happening? Also, if anybody else has had this problem and knows how to fix it?

    A similar inquery. Is there a way if I could check the height of the text in the label then change it's height based on that. I know there is a MeasureString function, but from what I have read it only gets the width of the text based on it's font.

    Thanks, Troy
    Prefix has no suffix, but suffix has a prefix.

  2. #2
    Frenzied Member
    Join Date
    Jan 2001
    Posts
    1,374

    Re: [2005] AutoSize Property

    To answer your first question, if the AutoSize property is set to True, the label will expand to fit its text. If you want a fixed size then set its AutoSize property to False.

  3. #3

    Thread Starter
    Hyperactive Member Troy Lundin's Avatar
    Join Date
    May 2006
    Posts
    489

    Re: [2005] AutoSize Property

    I know what AutoSize does. I am saying the label's height increases for no apparent reason.

    How about this. Is there a way to align the middle's of two controls in code.
    I am currently using

    Code:
    ctrl2.Top = Cint(ctrl1.height / 2) - (ctrl2.height / 2)
    Prefix has no suffix, but suffix has a prefix.

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: [2005] AutoSize Property

    Dim tSize As System.Drawing.SizeF = e.Graphics.MeasureString(label1.text, label1.font)

    MsgBox(tSize.Height)

    ' that'll measure your label text height

    try:

    (ctrl1.height - ctrl2.height) / 2

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