Maybe this will be helpfull for you:
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace KaraokeEditor
{
public class KaraokeDrawer
{
PictureBox _pBox;
public KaraokeDrawer(PictureBox pBox)
{
_pBox = pBox;
_pBox.Paint += pictureBox1_Paint;
_timer.Tick += Timer_Tick;
_timer.Start();
}
Timer _timer = new Timer() {Enabled = true, Interval = 50};
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
string text = "Hello World!";
var path = new GraphicsPath();
path.AddString(text, new FontFamily("Arial"), (int)FontStyle.Regular, 50, new Point(10, 10), StringFormat.GenericDefault);
e.Graphics.FillPath(new SolidBrush(Color.White), path);
Region r = new Region(path);
RectangleF rect = r.GetBounds(e.Graphics);
RectangleF intersectRect = new RectangleF(rect.X, rect.Y, rect.Width * _percent / 100, rect.Height);
r.Intersect(intersectRect);
e.Graphics.FillRegion(Brushes.Red, r);
e.Graphics.DrawPath(new Pen(Color.Blue), path);
}
int _percent = 0;
private void Timer_Tick(object sender, EventArgs e)
{
++_percent;
_pBox.Invalidate();
if (_percent >= 100)
{
_timer.Stop();
}
}
}
}