Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get single new line in a Rich Text Box to appear as single-spaced

I have a RichTextBox on a WPF window that I am using kind of like console output (output only). When I add a NewLine as in:

rtx_report.AppendText(lclFileInfo.pathOnly + System.Environment.NewLine);

it correctly adds just a single new line. (I know this from copying the text out of the box and pasting it somewhere else.) However, in the display it shows an additional whitespace row. So I started browsing the RichTextBox properties, but I am not sure which setting controls this.

It looks like it is just defaulting to double-spaced text, but I do not see anything that controls this. Can anyone explain how to get it to be single-spaced or otherwise not show that extra line?

TIA,

Paul

== Edit ==

P.S. More info as requested by HatSoft

The string content of lclFileInfo.pathOnly is C:\Users\Paul\Documents\Roadway

However, the same problem happens on all of these lines of code:

rtx_report.AppendText("File Changed:" + System.Environment.NewLine);
rtx_report.AppendText(lclFileInfo.pathOnly + System.Environment.NewLine);
if (lclFileInfo.isDirectory == false)
        rtx_report.AppendText(lclFileInfo.fileNameOnly + System.Environment.NewLine);
rtx_report.AppendText("Changed On: " + lclFileInfo.currentTimestamp + System.Environment.NewLine);
like image 611
philologon Avatar asked Jun 26 '12 08:06

philologon


People also ask

How do you insert a new line in RTF?

Add(new LineBreak()); // to add a new line use LineBreak() myParagraph.


1 Answers

Try this

rtx_report.AppendText(lclFileInfo.pathOnly + "\r");
like image 103
Dean Chalk Avatar answered Sep 23 '22 17:09

Dean Chalk