1234567891011121314151617181920212223242526272829303132333435 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace UAS_LabelMachine.CustomControl.RichText
- {
- public partial class RichTextAutoBottom : RichTextBox
- {
- public RichTextAutoBottom()
- {
- InitializeComponent();
- TextChanged += RichTextBox_TextChange;
-
- }
- private void RichTextBox_TextChange(object sender,EventArgs e)
- {
- SelectionStart = Text.Length;
- ScrollToCaret();
- }
- /// <summary>
- /// color设置AppendText的颜色
- /// </summary>
- /// <param name="str"></param>
- /// <param name="color"></param>
- public void AppendText(string str,Color color) {
- SelectionColor = color;
- base.AppendText(str);
- }
- }
- }
|