Requires Free Membership to View
When you register, you'll begin receiving targeted emails from my team of award-winning writers. Our goal is to provide a unique online resource for developers, architects and development managers tasked with building and maintaining enterprise applications using Visual Basic, C# and the Microsoft .NET platform.
Hannah Smalltree, Editorial Director
private void pictureBox1_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
{
e.Graphics.DrawString("Foo",
new System.Drawing.Font("Courier", 12),
System.Drawing.Brushes.Black,
(float)0.0, (float)0.0);
}
If you mean the System.Web.UI.WebControls.Image class for Web Forms applications, the only thing you can really do is specify an alternate text string and not set a valid URL for the ImageUrl property. Of course, you can always create an image file on the fly using the .NET drawing routines and then render that dynamically generated image file by specifying it as the ImageUrl property of the Image control. Jeff Prosise's Wicked Code column in MSDN Magazine August 2002 issues shows how to do this.
This was first published in May 2004