Page 1 of 1

Black Panel in bitmap - TeeChart Version 3.2.2980.19083

Posted: Tue Apr 01, 2008 5:44 pm
by 13048149
Hi There,

The code is as follows

private void Form1_Load(object sender, EventArgs e)
{
tChart1.Panel.MarginTop = 1;
tChart1.Panel.MarginBottom = 1;
tChart1.Panel.MarginUnits = Steema.TeeChart.PanelMarginUnits.Pixels;
tChart1.Panel.Transparent = false;
tChart1.Panel.Gradient.Visible = false;
tChart1.Walls.Back.Gradient.Visible = false;
tChart1.Walls.Back.Transparent = false;

tChart1.BackColor = Color.White;
tChart1.Panel.Color = Color.White;
tChart1.Walls.Back.Color = Color.White;

tChart1.Legend.Visible = false;
fastLine1.FillSampleValues(1000);

}

private void copyToClipboardToolStripMenuItem_Click(object sender, EventArgs e)
{

try
{
Bitmap bm = tChart1.Bitmap;
System.Windows.Forms.Clipboard.SetImage(bm);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}


}


The screen looks fine. When clipboard is pasted in paint you will see a black background.

I have uploaded the sample project too.

Regards
Srinivas

Posted: Wed Apr 02, 2008 8:28 am
by narcis
Hi Srinivas,

Thanks for the example project. I've been able to reproduce the issue here and added it (TF02012937) to the bug list to be fixed.

Posted: Wed May 28, 2008 2:35 pm
by narcis
Hi Srinivas,

We have been reviewing the example project you sent. We found that at designtime you set (see InitializeComponent's implementation):

Code: Select all

					this.tChart1.BackColor = System.Drawing.Color.Transparent;
and

Code: Select all

					this.tChart1.Panel.Brush.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
Since bitmap files don't support transparency, that's why you got images with a black background. To solve this issue, you can optionally comment out/remove those lines or use an image file format that supports transparency (GIF, PNF or TIFF).

There is another issue. Copying transparent PNG files to the clipboard means that they can only be pasted into Office2007 documents. Transparent PNG files cannot be pasted from the clipboard into a wide range of applications. You can use PNG.CopyToClipboard but only if you then do a "Paste Special" into an Office2007 document

However, transparent metafiles can also be pasted into any application, this works with your project:

Code: Select all

							tChart1.Export.Image.Metafile.CopyToClipboard();