using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace HS_INSURANCE_PLATFORM_FORM.BaseTool { public class ControlHelper { //定义一个用于保存静态变量的实例 private static ControlHelper instance = null; //定义一个保证线程同步的标识 private static readonly object locker = new object(); //构造函数为私有,使外界不能创建该类的实例 private ControlHelper() { } public static ControlHelper Instance { get { if (instance == null) { lock (locker) { if (instance == null) instance = new ControlHelper(); } } return instance; } } public void TxbWriteValue(TextBox txtContent, string value) { Console.WriteLine(value); txtContent.Text += value + "\r\n\r\n"; txtContent.Focus();//获取焦点 txtContent.Select(txtContent.TextLength, 0);//光标定位到文本最后 txtContent.ScrollToCaret();//滚动到光标处 } } }
博客内容主要用于日常学习记录,内容比较随意,如有问题,还需谅解!!!