示例#1
0
        /**
         *  Returns the cell height.
         *
         *  @return the cell height.
         */
        public float GetHeight()
        {
            float cellHeight = 0f;

            if (image != null)
            {
                float height = image.GetHeight() + topPadding + bottomPadding;
                if (height > cellHeight)
                {
                    cellHeight = height;
                }
            }

            if (barCode != null)
            {
                float height = barCode.GetHeight() + topPadding + bottomPadding;
                if (height > cellHeight)
                {
                    cellHeight = height;
                }
            }

            if (textBlock != null)
            {
                try {
                    float height = textBlock.DrawOn(null)[1] + topPadding + bottomPadding;
                    if (height > cellHeight)
                    {
                        cellHeight = height;
                    }
                }
                catch (Exception) {
                }
            }

            if (drawable != null)
            {
                try {
                    float height = drawable.DrawOn(null)[1] + topPadding + bottomPadding;
                    if (height > cellHeight)
                    {
                        cellHeight = height;
                    }
                }
                catch (Exception) {
                }
            }

            if (text != null)
            {
                float fontHeight = font.GetHeight();
                if (fallbackFont != null && fallbackFont.GetHeight() > fontHeight)
                {
                    fontHeight = fallbackFont.GetHeight();
                }
                float height = fontHeight + topPadding + bottomPadding;
                if (height > cellHeight)
                {
                    cellHeight = height;
                }
            }

            return(cellHeight);
        }