/// <summary>
        /// Calculate required drawing size for push button.
        /// </summary>
        /// <param name="g">Graphics reference used in calculations.</param>
        /// <param name="details">Source details needed to perform calculation.</param>
        /// <param name="topLevel">Drawing as a top level item.</param>
        /// <returns>Size of required area for command.</returns>
        public override Size CalculateDrawSize(Graphics g, ICommandDetails details, bool topLevel)
        {
            int width  = 0;
            int height = 0;

            // The size of the button area is calculated as....
            //
            // Size needed for image	(the image is not rotated when shown vertically)
            // Size needed for the text (the text is rotated when shown vertically)
            //

            // Do we have an image that needs positioning?
            if ((Image != null) && (details.ImageAndText != ImageAndText.TextOnly))
            {
                Size imageSize = ImageSpace(details.Style);

                width  = imageSize.Width;
                height = imageSize.Height;

                // With an image we need an extra pixel gap to the left (IDE and Office2003 only)
                if ((details.Style == VisualStyle.IDE) ||
                    (details.Style == VisualStyle.IDE2005) ||
                    (details.Style == VisualStyle.Office2003))
                {
                    width += SPACE_LEFT_EXTRA;
                }
            }

            // Do we have any text to position?
            if ((Text.Length > 0) && (details.ImageAndText != ImageAndText.ImageOnly))
            {
                // Get regular size of the text (horizontally)
                Size textSize = CommandDraw.TextSize(g, details.Font, Text);

                // Are we drawing the contents as if horizontal
                if ((details.Direction == LayoutDirection.Horizontal) || details.OnlyHorizontalText)
                {
                    // Position the text drawn horizontal
                    switch (details.TextEdge)
                    {
                    case TextEdge.Left:
                    case TextEdge.Right:
                        // Increase width by text width
                        width += textSize.Width;

                        // If we have an image as well then need a spacing gap
                        if (Image != null)
                        {
                            width += SPACE_GAP_WIDTH;
                        }

                        // Make sure height is enough for text
                        if (height < textSize.Height)
                        {
                            height = textSize.Height;
                        }
                        break;

                    case TextEdge.Top:
                    case TextEdge.Bottom:
                        // Increase height by text height
                        height += SPACE_HEIGHT + textSize.Height;

                        // If we have an image as well then need a spacing gap
                        if (Image != null)
                        {
                            height += SPACE_HEIGHT;
                        }

                        // Make sure width is enough for text
                        if (width < textSize.Width)
                        {
                            width = textSize.Width;
                        }
                        break;
                    }
                }
                else
                {
                    // Position the text drawn vertical
                    switch (details.TextEdge)
                    {
                    case TextEdge.Left:
                    case TextEdge.Right:
                        // Increase height text height
                        height += textSize.Width;

                        // If we have an image as well then need a spacing gap
                        if (Image != null)
                        {
                            height += SPACE_GAP_WIDTH;
                        }

                        // Make sure width is enough for text
                        if (width < textSize.Height)
                        {
                            width = textSize.Height;
                        }
                        break;

                    case TextEdge.Top:
                    case TextEdge.Bottom:
                        // Increase height by text height
                        width += textSize.Height;

                        // If we have an image as well then need a spacing gap
                        if (Image != null)
                        {
                            width += SPACE_HEIGHT;
                        }

                        // Make sure width is enough for text
                        if (height < textSize.Width)
                        {
                            height = textSize.Width;
                        }
                        break;
                    }
                }
            }

            // Calculate total area using borders and spacing gaps around inner size
            width  += (BORDER_WIDTH * 2) + (SPACE_WIDTH * 2);
            height += (BORDER_HEIGHT * 2) + (SPACE_HEIGHT * 2);

            // The width and height are always the same no matter which direction we are in
            return(new Size(width, height));
        }