Glossary Item Box

Overview: Overview

Controls: Binary Image

See Also AspLib component library Send comments on this topic.

How to initialize BinaryImage using stream

You can use next way to initialize image in BinaryImage control using any stream:

 

protected void BinaryImage1_ShowImage(object sender, AspLib.WebControls.ShowedImageArgs e)
{
     System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(200, 50);
     System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp);
     g.FillRectangle(new System.Drawing.SolidBrush(System.Drawing.Color.Yellow), 0, 0, 199, 49);
     g.DrawString(DateTime.Now.ToString(), new System.Drawing.Font("Arial", 10),
          new System.Drawing.SolidBrush(System.Drawing.Color.Red), 10, 10);

     MemoryStream stream = new MemoryStream();
     oBitmap.Save(stream, "image/jpeg");
     e.Image = stream.ToArray();

}

Overview: Overview

Controls: Binary Image

 

 


© 2002-2007 Astron Digital. All Rights Reserved.