OK.
How about using Graphics.Drawstring to create the image at load time and then recreate it if the text changes.
I like this better anyway as it is *not* an involved process.
CODE
.
.
.
toolStripMenuItem1.Image = drawText(toolStripMenuItem1.Text);
.
.
.
public Bitmap drawText(string text)
{
Bitmap b = new Bitmap(1, 1);
int width = 0;
int height = 0;
Font font = new Font("Arial", 12, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
Graphics g = Graphics.FromImage(b);
width = (int)g.MeasureString(text, font).Width;
height = (int)g.MeasureString(text, font).Height;
b=new Bitmap(b, new Size(width, height));
g = Graphics.FromImage(b);
g.Clear(Color.Transparent);
g.SmoothingMode = SmoothingMode.AntiAlias;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
g.DrawString(text, font, new SolidBrush(SystemColors.WindowText),0,0);
g.Flush();
return b;
}
I grabbed the drawText routine from:
http://chiragrdarji.wordpress.com/2008/05/...-image-using-c/I tested it and it seems to work in my admittedly limited prog.