I'm not sure what it is that you are asking for in
1.. All Controls have a Size property, if that is what you want. I suspect, however, that you mean the size of the area available for text.
The only way that I can think of is to use P/Invoke with the
EM_GETRECT Message[
^]. I've not tried it, so no guarantees.
As far as
2. is concerned, it depends on whether you want a percentage of the number of lines, the number of words or the number of characters.
Lines
The richtextbox has a
Lines
property and
MyRTB.Lines.Length
will give you the value.
Words
Here is a WordCount Method.
private int GetWordCount()
{
MatchCollection wordColl = Regex.Matches(richTextBox1.Text, @"[\W]+");
return wordColl.Count;
}
Characters
myRTB.TextLength
may be enough for what you need.
In all cases a quick bit of math will get your answer.
For deleting the text there are many methods but one of the easiest is to use the
myRTB.Text.Remove(int)[
^] method, or one of its' overrides.