C # RichTextBox automatically scrolls to the last cursor until the last line is automatically displayed
private void Richtextbox1_textchanged (object sender, EventArgs e)
{
Richtextbox1.selectionstart = Richtextbox1.textlength;
//Scrolls the contents of the control to the current caret position.
Richtextbox1.scrolltocaret (); Caret meaning: caret; insert symbol; (^)
}
Other:
rtxt.AppendText(message+
"\n"
);
rtxt.Select(rtxt.Text.Length, 0);
rtxt.ScrollToCaret();
C # RichTextBox garbled after reading txt Chinese.
Use the RichTextBox mechanism to generate RTF document content, and then pass in rich Text format content to the control
Http://www.cnblogs.com/wuhuacong/archive/2010/07/20/1781378.html
Or when reading the contents of the file, add the encoding
encoding.default); String strline = Sr. ReadLine (); StringBuilder sb = new StringBuilder (); while (strline! = null) { strline = Sr. ReadLine (); SB = sb. Append (strline + "\ n"); } Sr. Close (); richTextBox1.Text = sb. ToString ();
Other Answer 1:
StreamReader sr = new StreamReader (FS, System.Text.Encoding.UTF8);//test succeeded
Other Answer 2:
StreamReader sr = new StreamReader (FS, System.Text.Encoding.Default);
Change to try
StreamWriter SW = new StreamWriter (FS, System.Text.Encoding.GetEncoding ("GB2312"));
C # RichTextBox automatic pull-down to the last method