Board index » cppbuilder » RichEdit's Text Length in pixels
Rodolfo Frino - Macrosoft
![]() CBuilder Developer |
Rodolfo Frino - Macrosoft
![]() CBuilder Developer |
RichEdit's Text Length in pixels2004-01-09 08:44:25 AM cppbuilder6 Is there an accuarate way to calculate the length in pixels of the text (n lines) in RichEdit for any font (any Font Name and Font Size) TIA Rodolfo |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2004-01-09 09:16:22 AM
Re:RichEdit's Text Length in pixels
"Rodolfo Frino - Macrosoft" < XXXX@XXXXX.COM >wrote in message
QuoteIs there an accuarate way to calculate the length in pixels translate the offsets to pixels (there are messages available for that), and then query the difference in values. Gambit |
Rodolfo Frino - Macrosoft
![]() CBuilder Developer |
2004-01-09 09:55:51 AM
Re:RichEdit's Text Length in pixels
What do you mean by the text offset (or how do you measure it)?
Rodolfo {smallsort} |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2004-01-09 10:33:38 AM
Re:RichEdit's Text Length in pixels
"Rodolfo Frino - Macrosoft" < XXXX@XXXXX.COM >wrote in message
QuoteWhat do you mean by the text offset character is 1, and so on to the end of the text. That offset can then be translated into absolute pixel coordinates (and vice versa). There are also messages available for determining the character offset of the beginnning of individual lines in the text, and also to determine the lengths of thos lines. By determining the beginning and ending offsets of the first and last lines which you are interested in, you can then figure out how many pixels those lines take up on the screen. Gambit |
Rodolfo Frino - Macrosoft
![]() CBuilder Developer |
2004-01-09 11:37:29 AM
Re:RichEdit's Text Length in pixels
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote
Quotemessages available for determining the character offset of the beginnning (RichEdit1->Lines->Count)); I added a factor to take into account the space between lines. Of course the "factor" is different for different fonts sizes and font types (Font names), which makes it very difficult to adjust. I have also assumed that all lines have the same height, which is true in the my application. Rodolfo |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2004-01-09 01:23:15 PM
Re:RichEdit's Text Length in pixels
"Rodolfo Frino - Macrosoft" < XXXX@XXXXX.COM >wrote in message
QuoteWhich are the functions that do the translation? EM_POSFROMCHAR EM_LINEFROMCHAR EM_LINEINDEX EM_LINELENGTH QuoteI tried the approximate relationship |
Rodolfo Frino - Macrosoft
![]() CBuilder Developer |
2004-01-09 09:31:28 PM
Re:RichEdit's Text Length in pixels
oki doki and thanks
"Computers don't die, they password away", Rodolfo "Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message Quote
|
Pavel Vozenilek
![]() CBuilder Developer |
2004-01-10 05:24:28 PM
Re:RichEdit's Text Length in pixels
"Rodolfo Frino - Macrosoft" < XXXX@XXXXX.COM >wrote in message
QuoteIs there an accuarate way to calculate the length in pixels Sort a strange but worked for me. /Pavel |
Rodolfo Frino - Macrosoft
![]() CBuilder Developer |
2004-01-11 09:10:24 PM
Re:RichEdit's Text Length in pixels
Thank you Pavel, I will try that as soon as I can.
Rodolfo "Pavel Vozenilek" < XXXX@XXXXX.COM >wrote in message Quote
|