// draw the caption private void DrawCaption(Graphics g) { // background g.FillRectangle(this.BackBrush, this.DisplayRectangle); // caption if (_antiAlias) { g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; } // need a rectangle when want to use ellipsis RectangleF bounds = CtrlHelper.CheckedRectangleF(Consts.PosOffset, 0, this.DisplayRectangle.Width - Consts.PosOffset, this.DisplayRectangle.Height); g.DrawString(this.Text, this.Font, this.TextBrush, bounds, _format); }
protected override void OnPaintAdornments(PaintEventArgs pe) { base.OnPaintAdornments(pe); pe.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; //place the text in the left bottom SizeF _s = pe.Graphics.MeasureString(compName, m_Font, this.Control.Width, m_Format); if (this.MouseOver == true) { pe.Graphics.FillRectangle(new SolidBrush(Color.White), 0, this.Control.Height - _s.Height, _s.Width, _s.Height); pe.Graphics.DrawRectangle(new Pen(Color.Black), 0, this.Control.Height - _s.Height, _s.Width, _s.Height); pe.Graphics.DrawString("The Netron Project", m_Font, new SolidBrush(Color.Black), CtrlHelper.CheckedRectangleF(0, this.Control.Height - _s.Height, _s.Width, _s.Height), m_Format); } }