This is the high level problem I'm trying to solve...

I have a 3rd party plotting/graphing (IoComp Plot), and I want to embed a **high quality** (at least 600 dpi) bitmap of the Plot control in reports created by another 3rd party report package (Combit List & Label).

This is the approach that seems most promising so far...

**---Edit---:** 

After trying many other approachs, the only one that I think I can make work is to create a hidden instance of the Plot control, with everything scaled up to printer size (approx 5 times screen size). That includes width and height, font sizes, line widths - every visible component of the control. Yuck!

**------**

I can get a **Graphics** object of the proper resolution from the plot control's PrintPage event, but converting it to a Bitmap so the report package will be happy is proving to be the major stumbling block. Several hours of searching has led to other people who asked the same question, but no viable answers.

The only promising lead I've found suggested using one of the Bitmap constructors, which takes a Graphics instance as a parameter. 

However, it's not working for me. It creates Bitmap, but with no content from the Plot control - it is a pure black image.

Here's my code (edited to show drawing of red line to Graphics object):

```
void PrintDocument_PrintPage(object sender, PrintPageEventArgs e)
{
        // Draw a red line on the Graphics object. When printed, this
        // line is shown as part of the normal Plot graphics.
        Pen myPen;
        myPen = new Pen(Color.Red);
        e.Graphics.DrawLine(myPen, 0, 0, 200, 200);
        myPen.Dispose();

        // Create a bitmap from the Graphics object
        Bitmap bm = new Bitmap(1000, 1000, e.Graphics);

        // Save to disk 
        // DOES NOT WORK - CREATES FILE THAT IS PURE BLACK (VIEWED
        // WITH "PAINT" PROGRAM)
        bm.Save(@"C:\Bicw_Dev\Bic.Net\FrontEnd\GraphicsToBmp.bmp", ImageFormat.Bmp);
        bm.Dispose();
}

```

Can anyone suggest why this doesn't work? Is this even a valid approach?

Also, please note:

As far as I can determine (and I've spent quite a bit of time looking) **there is no way to get a high resolution, print quality Bitmap from the Plot control directly**! 

I stress this because several others who asked the question got code samples in response that solved the **opposite** problem - converting a Bitmap to a Graphics. 

I need to convert a **Graphics** object to a **Bitmap** object.

And if anyone can suggest an alternate approach that allows me to get a **print quality** image of my plots into my reports, please feel free. (For example, I can get a **low quality** (72 bpi) Bitmap from the Plot control, and have considered trying to stretch it - but I've never seen that approach work well in other applications).

Thanks,

-Tom Bushell

Edit in response to comment:

As an experiment, I added the following: 

```
Pen myPen; 
myPen = new Pen(Color.Red); 
e.Graphics.DrawLine(myPen, 0, 0, 200, 200); 
myPen.Dispose(); 

```

This caused a red line to be drawn over the plot graphics when I printed my plot. But it had no effect on the Bitmap - it's still pure black.