Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8688693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:26:22+00:00 2026-06-12T23:26:22+00:00

In my software written for Windows with Builder C++ 6, I need to create

  • 0

In my software written for Windows with Builder C++ 6, I need to create a .pdf article with some information the user edit and is stored in a database. Part of this information must be drawn inside a designed rect, so I need to check whatever the 55max character string will fit with just one line inside the rect. If not, than I need to calculate where I should give a new line (\n).

Normally texts do fit inside the rect having only 55 characters, but sometimes some uncommon text (such as “WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW…”), while having the same amount of characters, end up messing the whole thing. In other words, I can’t use the number of characters in the string to determinate when to give a new line, but rather the text’s length in pixels (or other measure unit), so I can check whatever the string will be bigger in the .pdf that it’s rect container or not.

I tried functions such as GetCharABCWidths(), GetTextExtentPoint32(), but had no success (either the so called “logical units” ere different each time I used the function for the same string/char and I didn’t know how to use them, or the length of the char was equal even when they were obviously different (‘1’ compared to ‘W’), or something else).

So how can I do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T23:26:24+00:00Added an answer on June 12, 2026 at 11:26 pm

    At the end, I was able to do what I wanted using this typ from Length of a string in pixels:

    To get a more accurate measurement, you can populate a TextField with
    the string, then measure the width of that TextField’s text.

    That went me back to Borland C++ Builder where I found a function (Canvas->TextExtent) that tells how much the String is goign to occupy in the canvas.

    So, problem solved!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On Windows/Linux platform,I as a common computer user,could not nearly find any software written
I need some help regarding a security problem in updating some Windows software for
Hi I have some software written in VB6.0 that uses an SQL Server, but
I have some software written in VB.NET that performs a lot of calculations, mostly
I have a piece of software written in C++ Builder 6 (yes, I know
Can software be written (for some specific programming language, platform, etc.) that will inform
My software is written in C++/MFC. I target Windows XP and later. Hence, I
I am very interested in how modern Windows software is written in C++ nowadays.
I am developing some scientific software for my university. It is being written in
I have a piece of server-ish software written in Java to run on Windows

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.