using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Drawing.Drawing2D; using System.Linq; using System.Text; using System.Windows.Forms; namespace HotelPms.Share.Windows.Component { public class GradientLabel : Label { private LinearGradientMode m_GradientMode = LinearGradientMode.Horizontal; [Description("EndBackColor"), Category("CTextBoxArray動作")] public LinearGradientMode GradientMode { get { return m_GradientMode; } set { m_GradientMode = value; this.Invalidate(); } } private Color m_EndBackColor = Color.FromArgb(120, 150, 150); [Description("EndBackColor"), Category("CTextBoxArray動作")] public Color EndBackColor { get { return m_EndBackColor; } set { m_EndBackColor = value; this.Invalidate(); } } protected override void OnPaintBackground(PaintEventArgs pevent) { base.OnPaintBackground(pevent); //BackColor Color.FromArgb(0, 64, 64) using (LinearGradientBrush brush = new LinearGradientBrush(this.ClientRectangle, BackColor, m_EndBackColor, m_GradientMode)) { pevent.Graphics.FillRectangle(brush, this.ClientRectangle); } } } }