/// <summary>
        /// Helper function to obtain array of rectangles from the 
        /// division result of the division type of interest. Each rectangle
        /// is inflated by the amount specified in the third parameter. This
        /// is done to ensure the visibility of all rectangles.
        /// </summary>
        /// <param name="divResult">Ink Divider division result</param>
        /// <param name="divType">Division type</param>
        /// <param name="inflate">Number of Pixels by which the rectangles are inflated</param>
        /// <returns> Array of rectangles containing bounding boxes of 
        /// division type specified by divType. The rectangles are in pixel unit.</returns>
        private Rectangle[] GetUnitBBoxes(DivisionResult divResult, InkDivisionType divType, int inflate)
        {
            // Declare the array of rectangles to hold the result
            Rectangle[] divRects;

            // Get the division units from the division result of division type
            DivisionUnits units = divResult.ResultByType(divType);

            // If there is at least one unit, we construct the rectangles
            if((null != units) && (0 < units.Count))
            {
                // We need to convert rectangles from ink units to
                // pixel units. For that, we need Graphics object
                // to pass to InkRenderer.InkSpaceToPixel method
                using (Graphics g = DrawArea.CreateGraphics())
                {

                    // Construct the rectangles
                    divRects = new Rectangle[units.Count];

                    // InkRenderer.InkSpaceToPixel takes Point as parameter.
                    // Create two Point objects to point to (Top, Left) and
                    // (Width, Height) properties of ractangle. (Width, Height)
                    // is used instead of (Right, Bottom) because (Right, Bottom)
                    // are read-only properties on Rectangle
                    Point ptLocation = new Point();
                    Point ptSize = new Point();

                    // Index into the bounding boxes
                    int i = 0;

                    // Iterate through the collection of division units to obtain the bounding boxes
                    foreach(DivisionUnit unit in units)
                    {
                        // Get the bounding box of the strokes of the division unit
                        divRects[i] = unit.Strokes.GetBoundingBox();

                        // The bounding box is in ink space unit. Convert them into pixel unit.
                        ptLocation = divRects[i].Location;
                        ptSize.X = divRects[i].Width;
                        ptSize.Y = divRects[i].Height;

                        // Convert the Location from Ink Space to Pixel Space
                        myInkOverlay.Renderer.InkSpaceToPixel(g, ref ptLocation);

                        // Convert the Size from Ink Space to Pixel Space
                        myInkOverlay.Renderer.InkSpaceToPixel(g, ref ptSize);

                        // Assign the result back to the corresponding properties
                        divRects[i].Location = ptLocation;
                        divRects[i].Width = ptSize.X;
                        divRects[i].Height = ptSize.Y;

                        // Inflate the rectangle by inflate pixels in both directions
                        divRects[i].Inflate(inflate, inflate);

                        // Increment the index
                        ++i;
                    }

                } // Relinquish the Graphics object
            }
            else
            {
                // Otherwise we return null
                divRects = null;
            }

            // Return the Rectangle[] object
            return divRects;
        }
        /// <summary>
        /// Helper function to obtain array of rectangles from the
        /// division result of the division type of interest. Each rectangle
        /// is inflated by the amount specified in the third parameter. This
        /// is done to ensure the visibility of all rectangles.
        /// </summary>
        /// <param name="divResult">Ink Divider division result</param>
        /// <param name="divType">Division type</param>
        /// <param name="inflate">Number of Pixels by which the rectangles are inflated</param>
        /// <returns> Array of rectangles containing bounding boxes of
        /// division type specified by divType. The rectangles are in pixel unit.</returns>
        private Rectangle[] GetUnitBBoxes(DivisionResult divResult, InkDivisionType divType, int inflate)
        {
            // Declare the array of rectangles to hold the result
            Rectangle[] divRects;

            // Get the division units from the division result of division type
            DivisionUnits units = divResult.ResultByType(divType);

            // If there is at least one unit, we construct the rectangles
            if ((null != units) && (0 < units.Count))
            {
                // We need to convert rectangles from ink units to
                // pixel units. For that, we need Graphics object
                // to pass to InkRenderer.InkSpaceToPixel method
                using (Graphics g = DrawArea.CreateGraphics())
                {
                    // Construct the rectangles
                    divRects = new Rectangle[units.Count];

                    // InkRenderer.InkSpaceToPixel takes Point as parameter.
                    // Create two Point objects to point to (Top, Left) and
                    // (Width, Height) properties of ractangle. (Width, Height)
                    // is used instead of (Right, Bottom) because (Right, Bottom)
                    // are read-only properties on Rectangle
                    Point ptLocation = new Point();
                    Point ptSize     = new Point();

                    // Index into the bounding boxes
                    int i = 0;

                    // Iterate through the collection of division units to obtain the bounding boxes
                    foreach (DivisionUnit unit in units)
                    {
                        // Get the bounding box of the strokes of the division unit
                        divRects[i] = unit.Strokes.GetBoundingBox();

                        // The bounding box is in ink space unit. Convert them into pixel unit.
                        ptLocation = divRects[i].Location;
                        ptSize.X   = divRects[i].Width;
                        ptSize.Y   = divRects[i].Height;

                        // Convert the Location from Ink Space to Pixel Space
                        myInkOverlay.Renderer.InkSpaceToPixel(g, ref ptLocation);

                        // Convert the Size from Ink Space to Pixel Space
                        myInkOverlay.Renderer.InkSpaceToPixel(g, ref ptSize);

                        // Assign the result back to the corresponding properties
                        divRects[i].Location = ptLocation;
                        divRects[i].Width    = ptSize.X;
                        divRects[i].Height   = ptSize.Y;

                        // Inflate the rectangle by inflate pixels in both directions
                        divRects[i].Inflate(inflate, inflate);

                        // Increment the index
                        ++i;
                    }
                } // Relinquish the Graphics object
            }
            else
            {
                // Otherwise we return null
                divRects = null;
            }

            // Return the Rectangle[] object
            return(divRects);
        }