using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace 优软MES.CustomControl.TransparentLabel { public partial class TransparentLabel : Label { public TransparentLabel() { InitializeComponent(); } protected override void OnPaint(PaintEventArgs pe) { pe.Graphics.DrawString(this.Text, this.Font, new SolidBrush(this.ForeColor), this.ClientRectangle); this.Parent.Controls.Add(this); this.ImageIndex = 20; this.BackColor = Color.Transparent; base.OnPaint(pe); } } }