Rounded Rectangle

Hi,

How can i get the angle/radius of the rounded corners of RoundedRectangle.

There are two value in Adjustments - RawValue,AngleValue


Regards

khushboo

Hi Khusboo,

I have observed your requirements and like to share that you can get or set the values for rounded rectangles using Aspose.Slides. The mapping that can be used with two types of shapes
mentioned in shared example has Adjustment
value ranges from 0 to 1. We have provided the mapping for Aspose.Slides
that you can use on your end to set the respective adjustment values.

public static void ModifyArcSize()
{
try
{
string path = @“D:\Aspose Data”;
string filename = path + “arcsize.pptx”;
Presentation p = new Presentation(filename);
// Debug.Assert(1 == p.Slides.Count);
ISlide s = p.Slides[0];
Debug.Assert(null != s);
Debug.Assert(1 == s.Shapes.Count);
IAutoShape shape = s.Shapes[0] as IAutoShape;
Debug.Assert(null != shape);

Debug.Assert(1 == shape.Adjustments.Count);
IAdjustValue av = shape.Adjustments[0];
Debug.Assert(null != av);
Console.WriteLine(“RawValue={0}; AngleValue={1}; Name=”{2}"", av.RawValue, av.AngleValue, av.Name);

double shapeHeight = shape.Height;
double shapeWidth = shape.Width;
double FrendlyValue = (double)av.RawValue * (shapeHeight / Math.Max(shapeWidth, shapeHeight)) / 50000;
double RawValue = (double)FrendlyValue * 50000 / (shapeHeight / Math.Max(shapeWidth, shapeHeight));

s = p.Slides[1];
Debug.Assert(null != s);
Debug.Assert(1 == s.Shapes.Count);
shape = s.Shapes[0] as IAutoShape;
Debug.Assert(null != shape);

Debug.Assert(1 == shape.Adjustments.Count);
IAdjustValue av2 = shape.Adjustments[0];
Debug.Assert(null != av2);
Console.WriteLine(“RawValue={0}; AngleValue={1}; Name=”{2}"", av2.RawValue, av2.AngleValue, av2.Name);

//The mapping for the particular case of Trapezoid preset shape type.
//RawValue values range is [0, 50000*(max(shapeWidth, shapeHeight)/shapeHeight)]
//Let FrendlyValue is RawValue scaled to [0,1] range. Then
shapeHeight = shape.Height;
shapeWidth = shape.Width;

FrendlyValue = (double)av2.RawValue * (shapeHeight / Math.Max(shapeWidth, shapeHeight)) / 50000;
RawValue = (double)FrendlyValue * 50000 / (shapeHeight / Math.Max(shapeWidth, shapeHeight));


s = p.Slides[2];
Debug.Assert(null != s);
Debug.Assert(1 == s.Shapes.Count);
shape = s.Shapes[0] as IAutoShape;
Debug.Assert(null != shape);

Debug.Assert(1 == shape.Adjustments.Count);
IAdjustValue av3 = shape.Adjustments[0];
Debug.Assert(null != av3);
Console.WriteLine(“RawValue={0}; AngleValue={1}; Name=”{2}"", av3.RawValue, av3.AngleValue, av3.Name);


//2) The mapping for the particular case of RoundCornerRectangle preset shape type.
// RawValue values range is [0, 50000]
//Let FrendlyValue is RawValue scaled to [0,1] range. Then
FrendlyValue = (double)av3.RawValue / 50000;
RawValue = FrendlyValue * 50000;

}
catch (Exception e)
{

}

}

Many Thanks,