• Physical string lenght

    Author
    Topic
    #1767427

    I am looking for a way to calculate the physycal length of a string. Not the number of characters! Font characteristics should therefore be parameters.

    Viewing 1 reply thread
    Author
    Replies
    • #1774797

      That’s a very interesting problem. Why do you need this measurement?

      • #1774938

        Yes I know it’s an interesting question! But do you have a answer? Otherwise why are you asking?

        • #1774974

          Because sometimes the question that you ask isn’t really what you need. If you explain what you’re trying to do, someone may have already found a way and can share it. For example, if you were trying to use the physical length of a string to try and align columns of text in a list box, there are already several solutions to that problem posted in various web sites.

          • #1775015

            Thank you Charlotte. This is the second time you’ve come to my defence re: responses to this persons posts. I’ll not bother him again with my apparently ignorant responses.

    • #1774987

      I know how to do this. It is a Microsoft API function and a couple of lines of code.

      • #1775001

        Thanks, but that doesn’t ring a bell with me. Could you be more specific?

        • #1775200

          You will require GetTextExtentPoint to calculate the width and height of the text string. The result is in pixels so you will then require GetDeviceCaps to convert the pixels to a inch (or cm) size.

          If you were more polite to others then they may return information to you in a useful format. The above information will get you started. Have fun.

          • #1775203

            Thank you very much for your help. I have fun and wish you have also a lot.

            John

    Viewing 1 reply thread
    Reply To: Physical string lenght

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: