/// <summary>
        /// Resizes the InkPicture to the bounding box of the Ink
        /// or the size of this panel (whichever is larger).  Call this
        /// after transforming the ink in a way that might change
        /// the ink's bounding box.
        /// TODO: resize such that we catch (allow scrolling for)
        /// ink with negative coordinate values.
        /// </summary>
        private void resizeInkPicture()
        {
            // Get lower right corner (x,y) of Ink
            Rectangle currentInkBoundingBox = inkPic.Ink.GetBoundingBox();

            System.Drawing.Point lowerRight = new System.Drawing.Point(currentInkBoundingBox.Right, currentInkBoundingBox.Bottom);
            lowerRight.X += SketchPanelConstants.SketchPaddingInk;
            lowerRight.Y += SketchPanelConstants.SketchPaddingInk;
            using (Graphics g = inkPic.CreateGraphics())
            {
                inkPic.Renderer.InkSpaceToPixel(g, ref lowerRight);
            }

            // For now, only make inkPic bigger.
            if (lowerRight.X > Math.Max(inkPic.Width, this.Width))
            {
                inkPic.Width = lowerRight.X;
            }
            //else
            //{
            //    inkPic.Width = this.Width;
            //}

            if (lowerRight.Y > Math.Max(inkPic.Height, this.Height))
            {
                inkPic.Height = lowerRight.Y;
            }
            //else
            //{
            //    inkPic.Height = this.Height;
            //}
        }
 /// <summary>
 /// Invalidate the stroke if FitToCurve is set or there is transparency.
 /// </summary>
 private void OnInkPicture_Stroke(object sender, Microsoft.Ink.InkCollectorStrokeEventArgs e)
 {
     if ((inkPicture.EditingMode == InkOverlayEditingMode.Ink) &&
         (inkPicture.DefaultDrawingAttributes.FitToCurve ||
          ((inkPicture.DefaultDrawingAttributes.Transparency > 0) && !m_optimizeForHighlighter.Checked)))
     {
         using (Graphics g = inkPicture.CreateGraphics())
         {
             inkPicture.Invalidate(InkSpaceToPixel(g, e.Stroke.GetBoundingBox()));
         }
     }
 }