Results 1 to 3 of 3

Thread: AutoSize as like Label

  1. #1

    Thread Starter
    Lively Member amolt's Avatar
    Join Date
    Aug 2006
    Location
    INDIA
    Posts
    80

    Question AutoSize as like Label

    Hello all,

    AutoSize property of label all we know. This makes the width of label expand as per the contents.

    I am using a 3rd party activex control which is drawn on image as annotation. This control returns its bounds in bitmap coordinates and can be set as well like that. The basic problem i am facing is to Set its width according to length of text which is set in it and also when to set it according to different font set and font sizes.

    Any ideas how to implement the AutoSize functionality for such use.

    For now temporary workaround I have done is to set the content to a label which is autosized, and then by converting the width of label to bitmap coordinates and then set it to the annotation activex. But still its not working perfectly.

    Regds,

  2. #2
    Frenzied Member
    Join Date
    Mar 2008
    Posts
    1,210

    Re: AutoSize as like Label

    I'm suprised the approach using the Label will not work, I should recheck your code for that.

    Alternatively use of the GetTextExtentPoint32 API Function may be of interest;
    http://msdn.microsoft.com/en-us/libr...38(VS.85).aspx
    http://tek-tips.com/viewthread.cfm?qid=1036091

  3. #3
    Addicted Member
    Join Date
    Jul 2010
    Posts
    158

    Re: AutoSize as like Label

    Hi,

    Why the " Autosized Label" workaround not working...? Before getting the width of label, have you set the Fontname/Size ....?

    Regards
    Veena

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