using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Drawing.Drawing2D; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace laserPTZ { public partial class TextBoxEx : TextBox { /// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// 清理所有正在使用的资源。 /// </summary> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } /// <summary> /// 设计器支持所需的方法 - 不要修改 /// 使用代码编辑器修改此方法的内容。 /// </summary> private void InitializeComponent() { components = new System.ComponentModel.Container(); } public TextBoxEx() { InitializeComponent(); } public String PlaceHolderStr { get; set; } protected override void OnPaint(PaintEventArgs e) { e.Graphics.DrawString("水平角度", this.Font, new SolidBrush(Color.Red), 10, 10); /*if (!String.IsNullOrEmpty(this.PlaceHolderStr)) { //坐标位置 0,0 需要根据对齐方式重新计算. e.Graphics.DrawString(this.PlaceHolderStr, this.Font, new SolidBrush(Color.LightGray), 10, 10); } else { base.OnPaint(e); }*/ } } }