Question: Building a little paint program and am trying to incorporate the concept of layers.

I'm using a PictureBox control to display the image, and getting the Graphics object from the image being displayed by the PictureBox and drawing to that.

My problem is I'm trying to figure out how to draw to a new Graphics object that is overlayed on top of the picture box, and be able to get the newly drawn image *without* the original image absorbed into the graphic.

If I do something like:

```
Graphics gr = Graphics.FromImage(myPictureBox.image);
gr.DrawRectangle(blah blah)

```

...I am editing the original image in the picture box. I want a way to only capture the new stuff being drawn as a separate image, but still have it displayed as an overlay over top of what was already there.

Anyone able to point me in the right direction? Thanks!

Answer: 
example code which working fine - take dummy image and layered the original image with custom text 

```
public void LayerImage(System.Drawing.Image Current, int LayerOpacity)
{
    Bitmap bitmap = new Bitmap(Current);        
    int h = bitmap.Height;
    int w = bitmap.Width;
    Bitmap backg = new Bitmap(w, h + 20);
    Graphics g = null;
    try
    {
        g = Graphics.FromImage(backg);
        g.Clear(Color.White);
        Font font = new Font("Arial", 12, FontStyle.Bold, GraphicsUnit.Pixel);
        RectangleF rectf = new RectangleF(70, 90, 90, 50);
        Color color = Color.FromArgb(255, 128, 128, 128);
        Point atpoint = new Point(backg.Width / 2, backg.Height - 10);
        SolidBrush brush = new SolidBrush(color);
        StringFormat sf = new StringFormat();
        sf.Alignment = StringAlignment.Center;
        sf.LineAlignment = StringAlignment.Center;
        g.DrawString("BRAND AMBASSADOR", font, brush, atpoint, sf);
        g.Dispose();
        MemoryStream m = new MemoryStream();
        backg.Save(m, System.Drawing.Imaging.ImageFormat.Jpeg);
    }
    catch { }

    Color pixel = new Color();

    for (int x = 0; x < bitmap.Width; x++)
    {
        for (int y = 0; y < bitmap.Height; y++)
        {
            pixel = bitmap.GetPixel(x, y);
            backg.SetPixel(x, y, Color.FromArgb(LayerOpacity, pixel));
        }
    }
    MemoryStream m1 = new MemoryStream();
    backg.Save(m1, System.Drawing.Imaging.ImageFormat.Jpeg);
    m1.WriteTo(Response.OutputStream);
    m1.Dispose();
    base.Dispose();
}

```
The graphics capabilities of .NET drawing libraries are simple. Their main purpose is direct drawing of GUI. If you want to have layering, alpha transparency or advanced filters, then you should either use 3rd party library or roll your own drawing code.