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(); }
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, image.Location.Y, image.Width, image.Height); c.ClipRectangle(borderRect); borderRect = new Rectangle(image.Location.X, image.Location.Y, image.Width, image.Height); c.FillRectangle(borderRect, image.BackgroundColor.ToCairoColor()); if (PixbufRepository.ContainsKey(image.ImageKey)) { var pixbuf = PixbufRepository[image.ImageKey]; c.DrawPixbuf(pixbuf, image.Location.ToCairoPointD(), image.Offset.ToCairoPointD()); } c.DrawInsideBorder(borderRect, image.Border, true); c.Restore(); }