using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Drawing.Design; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace DPumpHydr.WinFrmUI.WenSkin.Controls { public class WenInfoLable : WenControl { public WenInfoLable() : base() { } #region 公有属性 [Category("Wen"), Description("显示文字内容")] [Editor(typeof(Design.Editor.TextEditFormUITypeEditor), typeof(UITypeEditor))] public override string Text { get => base.Text; set { base.Text = value; this.Invalidate(); } } [Category("Wen"), Description("提示字符内容")] [Editor(typeof(Design.Editor.TextEditFormUITypeEditor), typeof(UITypeEditor))] public string TextLable { get; set; } #endregion protected override void WenOnPaint(Graphics g, Rectangle rec, PaintEventArgs e) { int infoWidth = TextRenderer.MeasureText(TextLable, Font).Width; Rectangle recinfo = new Rectangle(0, 0, infoWidth+2, Height); base.WenOnPaint(g, rec, e); DrawString(TextLable, g, recinfo); DrawString(Text, g, new Rectangle(infoWidth + 2, 0, Width - infoWidth - 2, Height)); } } }