/// <summary> /// Draw text. /// </summary> /// <param name="graphics">Graphics.</param> public virtual void DrawText(Graphics graphics) { using (var fgbrush = new SolidBrush(ForeColor)) using (var format = IronideConvert.ToStringFormat(TextAlign)) graphics.DrawString(Text, Font, fgbrush, ShowTitlebar ? new Rectangle(BorderThickness, titlePanel.Location.Y + titlePanel.Height, Width - BorderThickness, Height - (titlePanel.Location.Y + titlePanel.Height)) : new Rectangle( BorderThickness, BorderThickness, Width - BorderThickness, Height - BorderThickness), format); }
protected override void OnPaint(PaintEventArgs e) { if (Image == null) { DrawText(e.Graphics); } else { var X = ImageLocation.X + ImageSize.Width; e.Graphics.DrawImage(Image, new Rectangle(ImageLocation, ImageSize)); using (var fgbrush = new SolidBrush(ForeColor)) using (var format = IronideConvert.ToStringFormat(TextAlign)) e.Graphics.DrawString(Text, Font, fgbrush, new Rectangle( X, 0, Width - X, Height), format); } DrawBorder(e.Graphics); DrawEnable(e.Graphics); }
/// <summary> /// Draw text. /// </summary> /// <param name="graphics">Graphics.</param> public virtual void DrawText(Graphics graphics) { using (var fgbrush = new SolidBrush(ForeColor)) using (var format = IronideConvert.ToStringFormat(TextAlign)) graphics.DrawString(Text, Font, fgbrush, ClientRectangle, format); }