public override void Draw(Graphics graphics) { if (graphics == null) { throw new ArgumentNullException("graphics"); } using (Brush b = new SolidBrush(this.BackColor)){ graphics.FillRectangle(b, base.DrawingRectangle); } StringTrimming designTrimmimg = StringTrimming.EllipsisCharacter; if (this.stringTrimming != StringTrimming.None) { designTrimmimg = stringTrimming; } StringFormat stringFormat = TextDrawer.BuildStringFormat(designTrimmimg, contentAlignment); if (this.RightToLeft == System.Windows.Forms.RightToLeft.Yes) { stringFormat.FormatFlags = stringFormat.FormatFlags | StringFormatFlags.DirectionRightToLeft; } TextDrawer.DrawString(graphics, this.Text, this.Font, new SolidBrush(this.ForeColor), this.ClientRectangle, stringFormat); base.DrawControl(graphics, base.DrawingRectangle); }
public override void Draw(Graphics graphics) { if (graphics == null) { throw new ArgumentNullException("graphics"); } using (Brush b = new SolidBrush(this.BackColor)){ graphics.FillRectangle(b, base.DrawingRectangle); } string s = String.Format(System.Globalization.CultureInfo.CurrentCulture, "Error : <{0}> is missing or obsolete", base.Text); StringFormat stringFormat = TextDrawer.BuildStringFormat(base.StringTrimming, base.ContentAlignment); TextDrawer.DrawString(graphics, s, this.Font, new SolidBrush(Color.Red), this.ClientRectangle, stringFormat); base.DrawControl(graphics, base.DrawingRectangle); }
public override void Draw(Graphics graphics) { if (graphics == null) { throw new ArgumentNullException("graphics"); } using (var backgroundBrush = new SolidBrush(this.BackColor)){ graphics.FillRectangle(backgroundBrush, base.DrawingRectangle); } var designTrimmimg = StringTrimming.EllipsisCharacter; if (stringTrimming != StringTrimming.None) { designTrimmimg = stringTrimming; } stringFormat = TextDrawer.BuildStringFormat(designTrimmimg, contentAlignment); using (var textBrush = new SolidBrush(ForeColor)) { TextDrawer.DrawString(graphics, Text, Font, textBrush, ClientRectangle, stringFormat); } DrawControl(graphics, base.DrawingRectangle); }