using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace DisplayNameControl
{
    public partial class DisplayName : Control
    {
        public string str;

        public DisplayName()
        {
            //InitializeComponent();
            str = "A Name ";
        }
        public void DrawName()  //public method can be used by a parent class object
        {
            int x=10; int y=10;
            Graphics g = this.CreateGraphics();
            g.FillRectangle(Brushes.White, x, y, this.ClientRectangle.Width, this.ClientRectangle.Height);
            for (int i=0; i<str.Length; i++)
            {
                g.DrawString(str.Substring(i,1), this.Font, Brushes.Red, x, y);
                Thread.Sleep(200);
                x+=8;
            }
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            DrawName();
        }

    }
}