ComponentFactory.Krypton.Toolkit.ViewDrawContent.ShortTextRect C# (CSharp) Method

ShortTextRect() public method

Gets the short text drawing rectangle.
public ShortTextRect ( ViewContext context ) : Rectangle
context ViewContext
return System.Drawing.Rectangle
        public Rectangle ShortTextRect(ViewContext context)
        {
            Debug.Assert(context != null);

            // Validate incoming reference
            if (context == null) throw new ArgumentNullException("context");

            Rectangle textRect = Rectangle.Empty;

            // If we have some content to investigate
            if (_paletteContent.GetContentDraw(State) == InheritBool.True)
                textRect = context.Renderer.RenderStandardContent.GetContentShortTextRectangle(_memento);

            return textRect;
        }

Usage Example

Esempio n. 1
0
        /// <summary>
        /// Draw the canvas border.
        /// </summary>
        /// <param name="context"></param>
        public override void RenderBorder(RenderContext context)
        {
            // The first and only child is the caption content
            ViewDrawContent caption = (ViewDrawContent)this[0];

            // Remember current clipping region so we can put it back later
            Region clipRegion = context.Graphics.Clip.Clone();

            // Exclude the image/short/long text rectangles from being drawn
            Region    excludeRegion = clipRegion.Clone();
            Rectangle imageRect     = caption.ImageRectangle(context);
            Rectangle shortRect     = caption.ShortTextRect(context);
            Rectangle longRect      = caption.LongTextRect(context);

            imageRect.Inflate(1, 1);
            shortRect.Inflate(1, 1);
            longRect.Inflate(1, 1);
            excludeRegion.Exclude(imageRect);
            excludeRegion.Exclude(shortRect);
            excludeRegion.Exclude(longRect);

            // Draw border and restore original clipping region
            context.Graphics.Clip = excludeRegion;
            base.RenderBorder(context);
            context.Graphics.Clip = clipRegion;
        }