Measure an RTF string - DOTNET
This is a discussion on Measure an RTF string - DOTNET ; Hello
I have a RichTextBox in my .NET application. Is there a way to measure the
length of the appeared string in it? I mean is there something like
Graphics.MeasureString method that accepts MyRichTextBox.Rtf as the input
instead of a ...
-
Measure an RTF string
Hello
I have a RichTextBox in my .NET application. Is there a way to measure the
length of the appeared string in it? I mean is there something like
Graphics.MeasureString method that accepts MyRichTextBox.Rtf as the input
instead of a simple text?
Thanks in advance
Hamed
-
Re: Measure an RTF string
Short answer is "no".
I think however that you can discover the position of a character in the
rich text box. This may serve as a workaround.
The big problem of course is that a line of text may contain a lot of
different fonts and sizes. MeasureString only cares about a simple
string of characters.
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
Hamed wrote:
> Hello
>
> I have a RichTextBox in my .NET application. Is there a way to measure the
> length of the appeared string in it? I mean is there something like
> Graphics.MeasureString method that accepts MyRichTextBox.Rtf as the input
> instead of a simple text?
>
> Thanks in advance
>
> Hamed
>
>
>
-
Re: Measure an RTF string
> Hamed wrote:
>> Hello
>>
>> I have a RichTextBox in my .NET application. Is there a way to measure
>> the
>> length of the appeared string in it? I mean is there something like
>> Graphics.MeasureString method that accepts MyRichTextBox.Rtf as the input
>> instead of a simple text?
>>
>> Thanks in advance
>>
>> Hamed
You mean there is no tools or workaround the RTF? How can I measure this? I
have a lot of international characters, formating characters, colored and
bold characters, etc.
"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:uykitMdVHHA.488@TK2MSFTNGP06.phx.gbl...
> Short answer is "no".
>
> I think however that you can discover the position of a character in the
> rich text box. This may serve as a workaround.
>
> The big problem of course is that a line of text may contain a lot of
> different fonts and sizes. MeasureString only cares about a simple string
> of characters.
>
> --
> Bob Powell [MVP]
> Visual C#, System.Drawing
>
> Ramuseco Limited .NET consulting
> http://www.ramuseco.com
>
> Find great Windows Forms articles in Windows Forms Tips and Tricks
> http://www.bobpowell.net/tipstricks.htm
>
> Answer those GDI+ questions with the GDI+ FAQ
> http://www.bobpowell.net/faqmain.htm
>
> All new articles provide code in C# and VB.NET.
> Subscribe to the RSS feeds provided and never miss a new article.
>
>
>
>
>
>>
>>
-
Re: Measure an RTF string
No, I guess not. The RTF control is "as is", which means there's nothing
more (not much, at least) than documented.
You can get the y-coordinate "after the last line", but not the x-coordinate
("line width if there's only one line").
Christian
"Hamed" <hamed@raymehr.com> wrote in message
news:ezQrWUWWHHA.600@TK2MSFTNGP05.phx.gbl...
>> Hamed wrote:
>>> Hello
>>>
>>> I have a RichTextBox in my .NET application. Is there a way to measure
>>> the
>>> length of the appeared string in it? I mean is there something like
>>> Graphics.MeasureString method that accepts MyRichTextBox.Rtf as the
>>> input
>>> instead of a simple text?
>>>
>>> Thanks in advance
>>>
>>> Hamed
>
> You mean there is no tools or workaround the RTF? How can I measure this?
> I
> have a lot of international characters, formating characters, colored and
> bold characters, etc.
>
>
> "Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
> news:uykitMdVHHA.488@TK2MSFTNGP06.phx.gbl...
>> Short answer is "no".
>>
>> I think however that you can discover the position of a character in the
>> rich text box. This may serve as a workaround.
>>
>> The big problem of course is that a line of text may contain a lot of
>> different fonts and sizes. MeasureString only cares about a simple string
>> of characters.
>>
>> --
>> Bob Powell [MVP]
>> Visual C#, System.Drawing
>>
>> Ramuseco Limited .NET consulting
>> http://www.ramuseco.com
>>
>> Find great Windows Forms articles in Windows Forms Tips and Tricks
>> http://www.bobpowell.net/tipstricks.htm
>>
>> Answer those GDI+ questions with the GDI+ FAQ
>> http://www.bobpowell.net/faqmain.htm
>>
>> All new articles provide code in C# and VB.NET.
>> Subscribe to the RSS feeds provided and never miss a new article.
>>
>>
>>
>>
>>
>>>
>>>
>
Similar Threads
-
By Application Development in forum labview
Replies: 1
Last Post: 12-08-2007, 05:40 PM
-
By Application Development in forum Perl
Replies: 0
Last Post: 08-30-2007, 02:03 AM
-
By Application Development in forum Java
Replies: 1
Last Post: 08-27-2007, 01:31 AM
-
By Application Development in forum Adobe illustrator
Replies: 0
Last Post: 01-15-2007, 08:00 AM
-
By Application Development in forum XML SOAP
Replies: 2
Last Post: 01-13-2006, 03:08 AM