Page 1 of 1

Image Transparency Issue & CustomTargetRectangle Issue

Posted: Thu Jun 05, 2008 4:32 pm
by 14046227
I have downloaded your latest version of TeeChart because the Image on a TeeChart Back Wall will not work with Transparency. With the latest download it still does not work. I read your notes indicating this bug was fixed, can you direct me as to how I can get image transparency to work on the back wall and I also need image transparency to work on the panel itself.

Also, I am trying to modify the following:

MainChart.Walls.Back.Gradient.CustomTargetRectangle.Width = e.Value;

but when i try to compile this I get:

Cannot modify the return value of 'Steema.TeeChart.Drawing.Gradient.CustomTargetRectangle' because it is not a variable

your metadata indicates it is a property. What's up?

Thanks In advance

Posted: Fri Jun 06, 2008 2:15 pm
by narcis
Hi MattHolmes,
I have downloaded your latest version of TeeChart because the Image on a TeeChart Back Wall will not work with Transparency. With the latest download it still does not work. I read your notes indicating this bug was fixed, can you direct me as to how I can get image transparency to work on the back wall and I also need image transparency to work on the panel itself.
Could you please indicate us which is the release notes comment which suggests the bug was fixed? Is there an issue tracking number associated with it?
Also, I am trying to modify the following:

MainChart.Walls.Back.Gradient.CustomTargetRectangle.Width = e.Value;

but when i try to compile this I get:

Cannot modify the return value of 'Steema.TeeChart.Drawing.Gradient.CustomTargetRectangle' because it is not a variable

your metadata indicates it is a property. What's up?
CustomTargetRectangle is a property of type System.Drawing.Rectangle and therefore you can assign it a Rectangle with its corresponding location and dimensions as shown here:

Code: Select all

			Rectangle rect = new Rectangle(0, 0, 100, 100);
			tChart1.Walls.Back.Gradient.CustomTargetRectangle = rect;
Thanks in advance.

Posted: Fri Jun 06, 2008 3:32 pm
by 14046227
You didn't answer the first part of my message

Image Transparency Issue

Posted: Fri Jun 06, 2008 10:35 pm
by 14046227
I have downloaded your latest version of TeeChart because the Image on a TeeChart Back Wall will not work with Transparency. With the latest download it still does not work. I read your notes indicating this bug was fixed, can you direct me as to how I can get image transparency to work on the back wall and I also need image transparency to work on the panel itself.

Posted: Mon Jun 09, 2008 1:11 pm
by narcis
Hello,

You can do something like this:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}
				
		private void InitializeChart()
		{
			Steema.TeeChart.Styles.Points points1 = new Steema.TeeChart.Styles.Points(tChart1.Chart);
			points1.FillSampleValues();

			tChart1.Walls.Back.Transparency = 50;	

			tChart1.Panel.Gradient.Visible = false;
			tChart1.Panel.Image = pictureBox1.Image;
		}
Is that what are you looking for?

Thanks in advance.

Posted: Mon Jun 09, 2008 4:00 pm
by 14046227
I appreciate your feedback but this code won't work.

If I have a gradient on the panel, I want to keep it in addition to have a transparency setting on an image on the back wall of a plot.

this is what I am doing for a transparency event with an image already loaded.

private void SetInnerImageTransparency (object sender, Int32EventArgs e)
{
//MainChart.Walls.Back.ImageTransparent = false;
MainChart.Walls.Back.Brush.Visible = true;
MainChart.Walls.Back.Transparency = e.Value;
MainChart.Walls.Back.Gradient.Visible = false;
// MainChart.Walls.Back.ImageMode = ImageMode.Stretch;
// MainChart.Panel.Gradient.Visible = false;
}

This does not influence the transparency on an Image on the Back Wall of a plot.

Once again, in this scenario, the image is only on a plot's back wall not the surrounding panel

I also have the reverse situation. But lets fix this first please.

Thanks for your help.

Ed Reyes

Posted: Mon Jun 09, 2008 4:29 pm
by Chris
Hello,
Ed wrote: If I have a gradient on the panel, I want to keep it in addition to have a transparency setting on an image on the back wall of a plot.
What's happening here is that the chart cannot render a gradient and an image on the panel at the same time. This is why panel.gradient.visible has to be set to false. In previous versions of the chart, the panel.gradient was not visible by default and so the problem was not so obvious.

You will not 'lose' the panel.gradient by setting it to visible=false, as this code shows:

Code: Select all

    public Form1()
    {
      InitializeComponent();
      InitializeChart();
    }

    private void InitializeChart()
    {
      Steema.TeeChart.Styles.Points points1 = new Steema.TeeChart.Styles.Points(tChart1.Chart);
      points1.FillSampleValues();

      tChart1.Walls.Back.Transparency = 20;

      tChart1.Panel.Gradient.StartColor = Color.Pink;
      tChart1.Panel.Gradient.EndColor = Color.PowderBlue;
      tChart1.Panel.Gradient.Visible = false;
      tChart1.Panel.Image = pictureBox1.Image; 
    }

    bool flag = true;
    private void button1_Click(object sender, EventArgs e)
    {
      //toggle gradient/image
      tChart1.Panel.Gradient.Visible = flag;
      flag = !flag;
    }
I understand that you would prefer not to set the panel.gradient.visible=false and that you would prefer the gradient to re-appear automatically when setting the panel.image=null without having to reset the panel.gradient.visible to true. We will look into fixing this in a future maintenance release (bug tracking number TF02013118). In the meantime, the workaround as suggested above should be sufficient.

Posted: Tue Jun 10, 2008 9:58 am
by Chris
Hello,
Chris wrote:We will look into fixing this in a future maintenance release (bug tracking number TF02013118). In the meantime, the workaround as suggested above should be sufficient.
Ok, we've looked into this, however, there is a problem with implementing a fix which toggles the gradient and the image of the panel by setting the image to null and this is that images cannot be stored in *.ten files for later use. Use the code below to see what I mean, pressing the buttons in order (1, 2, 3):

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.Points points1 = new Steema.TeeChart.Styles.Points(tChart1.Chart);
			points1.FillSampleValues();

			tChart1.Walls.Back.Transparency = 20;

			tChart1.Panel.Gradient.StartColor = Color.Pink;
			tChart1.Panel.Gradient.EndColor = Color.PowderBlue;
			//tChart1.Panel.Gradient.Visible = true; //1
			tChart1.Panel.Gradient.Visible = false;	//2
			tChart1.Panel.Image = pictureBox1.Image;
		}

		bool flag = true;
		private void button1_Click(object sender, EventArgs e)
		{
			//toggle gradient/image
			//tChart1.Panel.Image = flag ? null : pictureBox1.Image; //1
			//flag = !flag;//1


			tChart1.Panel.Gradient.Visible = flag;	//2
			flag = !flag;//2
		}

		private void button2_Click(object sender, EventArgs e)
		{
			MemoryStream ms = new MemoryStream();
			tChart1.Export.Template.Save(ms);
			ms.Position = 0;
			tChart2.Import.Template.Load(ms);
		}

		private void button3_Click(object sender, EventArgs e)
		{
			tChart2.Panel.Gradient.Visible = false;
		}
Here you will be able to see that pressing the third button causes the image to reappear in the second chart. Implemented code which causes the toggle to occur by assigning null or an image to the Panel.Image, as in the commented code //2, means that the image does not reappear when button3 is pressed as the image has not been serialized (it is null). In our opinion, therefore, making a change to the chart code to toggle image rendering by setting the image to null reduces functionality with respect to chart serialization. For this reason we will not implement a fix to this issue.