using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace HTEXMark { public class RichTextBoxEx : RichTextBox { public string PlaceHolder { get; set; } protected override void WndProc(ref Message m) { base.WndProc(ref m); if (m.Msg == 0xF || m.Msg == 0x133) { WmPaint(ref m); } } private void WmPaint(ref Message m) { Graphics g = Graphics.FromHwnd(base.Handle); if (!String.IsNullOrEmpty(this.PlaceHolder) && string.IsNullOrEmpty(this.Text)) g.DrawString(this.PlaceHolder, this.Font, new SolidBrush(Color.LightGray), 0, 0); } } }