Page 1 of 1

Setting Trasparency of Shape to 50%

Posted: Fri Feb 29, 2008 7:54 am
by 7666477
Is there any way of settings the transparency of a shape to 50%. This is the code I currently have:

com.steema.teechart.styles.Shape prediction = new com.steema.teechart.styles.Shape(chart.getChart());
prediction.setColor(Color.RED);
prediction.setStyle(ShapeStyle.RECTANGLE);

The only function I can see is this:
prediction.setTransparent(true);
But I want to st it to 50%

Posted: Fri Feb 29, 2008 10:10 am
by narcis
Hi Happy,

Yes, this is possible using this:

Code: Select all

        com.steema.teechart.styles.Shape shape1 = new com.steema.teechart.styles.Shape(tChart.getChart());
        
        shape1.setX0(0);
        shape1.setY0(0);
        shape1.setX1(100);
        shape1.setY1(100);
        
        shape1.getGradient().setVisible(true);
        shape1.getGradient().setStartColor(Color.RED);
        shape1.getGradient().setEndColor(Color.RED);
        shape1.getGradient().setTransparency(50);

Posted: Fri Feb 29, 2008 10:28 am
by 7666477
WORKS GREAT!!! Many Thanks!

Posted: Mon Mar 03, 2008 8:54 am
by 7666477
Relating to this same topic:
Is there a way to remove the border of the shape at runtime?

Posted: Mon Mar 03, 2008 11:58 am
by narcis
Hi Happy,

Yes, this can be done like this:

Code: Select all

        shape1.getPen().setVisible(true);