public void Render(Cairo.Context c, MonoReports.Model.Controls.Control control)
        {
            Image image = control as Image;
            Rectangle borderRect;
            c.Save ();
            borderRect = new Rectangle (image.Location.X  * unitMulitipier, image.Location.Y  * unitMulitipier, image.Width   * unitMulitipier, image.Height * unitMulitipier);
            c.ClipRectangle (borderRect);

            if ( PixbufRepository.ContainsKey(image.ImageKey)) {
                var pixbuf = PixbufRepository[image.ImageKey];
                c.DrawPixbuf (pixbuf, new Cairo.PointD(image.Location.X * unitMulitipier , image.Location.Y  * unitMulitipier), (int)(image.Width * unitMulitipier),(int)(image.Height * unitMulitipier), image.Offset.ToCairoPointD ());
            }else {
                c.FillRectangle (borderRect, image.BackgroundColor.ToCairoColor ());
            }
            c.DrawInsideBorder (borderRect, image.Border, true);
            c.Restore ();
        }
Example #2
0
        public void Render(Cairo.Context c,Control control)
        {
            TextBlock textBlock = control as TextBlock;
            Rectangle borderRect;
            c.Save();
            borderRect = new Rectangle (textBlock.Location.X, textBlock.Location.Y, textBlock.Width, textBlock.Height);
            if(!textBlock.CanGrow || DesignMode)
                c.ClipRectangle(borderRect);

            var rect = c.DrawTextBlock (textBlock,false);
            if(!DesignMode && (textBlock.CanGrow && rect.Height > textBlock.Height || textBlock.CanShrink && rect.Height < textBlock.Height)){
                borderRect = new Rectangle (textBlock.Location.X, textBlock.Location.Y, textBlock.Width, rect.Height);
            } else {
                borderRect = new Rectangle (textBlock.Location.X, textBlock.Location.Y, textBlock.Width, textBlock.Height);
            }

            c.FillRectangle(borderRect,textBlock.BackgroundColor.ToCairoColor());
            c.DrawTextBlock (textBlock,true);
            c.DrawInsideBorder  (borderRect, textBlock.Border,true);
            c.Restore();
        }