public partial class custombutton : Button { public custombutton() { InitializeComponent(); } protected override void OnPaint(PaintEventArgs pe) { base.OnPaint(pe); RenderRainbowText(this.Text, 'V', this); } public void RenderRainbowText(string Text, char keyword, Control Lb) { System.Drawing.Graphics formGraphics = this.CreateGraphics(); string[] chunks = Text.Split(keyword); string word = keyword.ToString(); // USED FOR DRAWING chunk SolidBrush brush = new SolidBrush(Color.Red); SolidBrush brush1 = new SolidBrush(Color.Black); float x = 0; for (int i = 0; i < chunks.Length; i++) { formGraphics.DrawString(chunks[i], Lb.Font, brush1, x, 0); x += (formGraphics.MeasureString(chunks[i], Lb.Font)).Width; //CODE TO MEASURE AND DRAW alphabet if (i < (chunks.Length - 1)) { formGraphics.DrawString(word, Lb.Font, brush, x, 0); x += (formGraphics.MeasureString(",", Lb.Font)).Width; } } } }