Page 1 of 1

CopyToClipBoard

Posted: Wed Sep 20, 2006 11:03 pm
by 9790735
Hi,

when using Chart.Export.Image.Bitmap.CopyToClipboard and pasting to 'Paint' application, the background is always Blue, although it is WhiteSmoke on the display.
Chart.BackColor = Color.WhiteSmoke;

To get it to be the correct color, I must set the Chart.Panel.Brush.Visible = true and set the brush up with the correct colors and some hashstyle.
Do the Copy, then set it back to false.

It is blue for bitmap or JPEG. I did not try others.

Why is this? is this fixed in the upcoming release? doesnt make sense.

thanks,

Posted: Thu Sep 21, 2006 8:31 am
by narcis
Hi matthbri,

Copying to clipboard or exporting to JPEG and Bitmap works fine for me here using latest debug build available at the client area, a chart with default settings and this code:

Code: Select all

      tChart1.BackColor = Color.WhiteSmoke;
      tChart1.Export.Image.JPEG.Save(@"e:\temp\backcolor.jpg");
      tChart1.Export.Image.Bitmap.Save(@"e:\temp\backcolor.bmp");
We expect to have a new maintenance release ready in the upcoming days. Which TeeChart version are you using?

Posted: Thu Sep 21, 2006 2:59 pm
by 9790735
I am using 2.0.2306.26232

I wll try the new release first. If it is the same, I will make a small repro.

NOTE that if I do Char.Draw(g, rc) is uses the correct colors.

Brian

Posted: Thu Sep 21, 2006 3:03 pm
by narcis
Hi Brian,

If you want to be sure you can send us an example we can run "as-is" and I'll test it with the latest debug build and our current sources.

You can post your files at news://www.steema.net/steema.public.attachments newsgroup.

Posted: Thu Sep 21, 2006 3:34 pm
by 9790735
OK, I have posted a testapp subject 'CopyToClipBoard'

run, click the button, and paste in 'Paint' app



Brian

Posted: Fri Sep 22, 2006 11:05 am
by narcis
Hi Brian,

Thanks for the example. We could reproduce your problem here and found its cause. The problem is that you set the panel's brush no not visible:

Code: Select all

      tChart1.Panel.Brush.Visible = false;
Just commenting out this line will solve the issue. Also, if you don't want the spheric brush style also comment out the following line:

Code: Select all

      tChart1.Panel.Brush.Style = System.Drawing.Drawing2D.HatchStyle.Sphere;

Posted: Fri Sep 22, 2006 2:51 pm
by 9790735
OK, thanks.

but it still seems strange that the bitmap export does not match what you see on the screen....

Posted: Fri Sep 22, 2006 2:58 pm
by 9790735
Hi,

Actually this suggestion is no good. If I enable the brush, the screen appearance has now changed. it has some kind of pattern on it, dependant on the brush style.

So before the export I make the brush visible, then after the export invisible. This does what I want, but it is a workaround in my opinion, not a fix.

For your info, the previous version of TeeChart did not have this problem.
It was introduced in build 2.0.2306.26232

Posted: Fri Sep 22, 2006 3:27 pm
by narcis
Hi matthbri,

As I said in my last post, This is because you set:

Code: Select all

      tChart1.Panel.Brush.Style = System.Drawing.Drawing2D.HatchStyle.Sphere;
To avoid this pattern afecting the image please comment that line as well.

Setting the brush not visible is like making the chart transparent. You can find the explanation of this phenomena (copying an image to the clipboard adds blue background) here.

Posted: Fri Sep 22, 2006 3:31 pm
by 9790735
I commented out the brush style and got some kind of hashed appearance. The styles do not include a solid?

I still dont see why the export image should be different to the screen image. Doesnt make sense.

Posted: Mon Sep 25, 2006 7:43 am
by narcis
Hi matthbri,
I commented out the brush style and got some kind of hashed appearance. The styles do not include a solid?


You already made it solid using:

Code: Select all

      tChart1.Panel.Brush.Solid = true;
I still dont see why the export image should be different to the screen image. Doesnt make sense.
Have you read the message I pointed you to? Please read that whole thread for an explanation to this.