public static void FindShapeSizes(Shape shape)
{
//ExStart
//ExFor:ShapeRenderer.SizeInPoints
//ExId:ShapeRendererSizeInPoints
//ExSummary:Demonstrates how to find the size of a shape in the document and the size of the shape when rendered.
SizeF shapeSizeInDocument = shape.GetShapeRenderer().SizeInPoints;
float width = shapeSizeInDocument.Width; // The width of the shape.
float height = shapeSizeInDocument.Height; // The height of the shape.
//ExEnd
//ExStart
//ExFor:ShapeRenderer.GetSizeInPixels
//ExId:ShapeRendererGetSizeInPixels
//ExSummary:Shows how to create a new Bitmap and Graphics object with the width and height of the shape to be rendered.
// We will render the shape at normal size and 96dpi. Calculate the size in pixels that the shape will be rendered at.
Size shapeRenderedSize = shape.GetShapeRenderer().GetSizeInPixels(1.0f, 96.0f);
using (Bitmap image = new Bitmap(shapeRenderedSize.Width, shapeRenderedSize.Height))
{
using (Graphics g = Graphics.FromImage(image))
{
// Render shape onto the graphics object using the RenderToScale or RenderToSize methods of ShapeRenderer class.
}
}
//ExEnd
}