CamTimer.Controls.HelpLabel.OnPaint C# (CSharp) Method

OnPaint() protected method

protected OnPaint ( PaintEventArgs e ) : void
e PaintEventArgs
return void
        protected override void OnPaint(PaintEventArgs e)
        {
            double transparency = 1-m_opacity;
            try {
                Color pbc = Parent.BackColor;

                // BackColor to Parent.BackColor (add or remove from individual components until they reach Parent.BackColor)
                Color bc = Color.FromArgb(BackColor.R + (int)(((int)pbc.R - (int)BackColor.R) * transparency), BackColor.G + (int)(((int)pbc.G - (int)BackColor.G) * transparency), BackColor.B + (int)(((int)pbc.B - (int)BackColor.B) * transparency));

                // ForeColor to Parent.BackColor
                Color fc = Color.FromArgb(ForeColor.R + (int)(((int)pbc.R - (int)ForeColor.R) * transparency), ForeColor.G + (int)(((int)pbc.G - (int)ForeColor.G) * transparency), ForeColor.B + (int)(((int)pbc.B - (int)ForeColor.B) * transparency));

                e.Graphics.Clear(bc);
                TextRenderer.DrawText(e.Graphics, Title.Replace("&", "&&"), m_boldFont, Rectangle.FromLTRB(17, 11, Width - 17, 11 + 100), fc, TextFormatFlags.EndEllipsis | TextFormatFlags.SingleLine);
                TextRenderer.DrawText(e.Graphics, Text.Replace("&", "&&"), Font, Rectangle.FromLTRB(17, 37, Width - 17, 37 + 100), fc, TextFormatFlags.EndEllipsis | TextFormatFlags.WordBreak);
            } catch (Exception) { }
        }