public void Render(Cairo.Context c, MonoReports.Model.Controls.Control control) { Section section = control as Section; Rectangle borderRect; c.Save (); borderRect = new Rectangle (section.Location.X * unitMulitipier , section.Location.Y * unitMulitipier , section.Width * unitMulitipier, section.Height * unitMulitipier); c.FillRectangle (borderRect, section.BackgroundColor.ToCairoColor()); c.Restore (); }
public void Render(Cairo.Context c, MonoReports.Model.Controls.Control control) { SubReport subreport = control as SubReport; Rectangle borderRect; c.Save (); borderRect = new Rectangle (subreport.Location.X, subreport.Location.Y, subreport.Width, subreport.Height); c.ClipRectangle (borderRect); borderRect = new Rectangle (subreport.Location.X, subreport.Location.Y, subreport.Width, subreport.Height); c.FillRectangle (borderRect, subreport.BackgroundColor.ToCairoColor ()); 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 * 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 (); }
private void DrawBackground(Cairo.Context g, Cairo.Rectangle rect, StyleInfo si) { // LinearGradientBrush linGrBrush = null; // SolidBrush sb = null; if (si.BackgroundColor.IsEmpty) return; g.Save(); Cairo.Color c = si.BackgroundColor.ToCairoColor(); Cairo.Gradient gradient = null; if (si.BackgroundGradientType != BackgroundGradientTypeEnum.None && !si.BackgroundGradientEndColor.IsEmpty) { Cairo.Color ec = si.BackgroundGradientEndColor.ToCairoColor(); switch (si.BackgroundGradientType) { case BackgroundGradientTypeEnum.LeftRight: // linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.Horizontal); gradient = new Cairo.LinearGradient(rect.X, rect.Y, rect.X + rect.Width, rect.Y); break; case BackgroundGradientTypeEnum.TopBottom: // linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.Vertical); gradient = new Cairo.LinearGradient(rect.X, rect.Y, rect.X, rect.Y + rect.Height); break; case BackgroundGradientTypeEnum.Center: // linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.Horizontal); throw new NotSupportedException(); // break; case BackgroundGradientTypeEnum.DiagonalLeft: // linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.ForwardDiagonal); gradient = new Cairo.LinearGradient(rect.X, rect.Y, rect.X + rect.Width, rect.Y + rect.Height); break; case BackgroundGradientTypeEnum.DiagonalRight: // linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.BackwardDiagonal); gradient = new Cairo.LinearGradient(rect.X + rect.Width, rect.Y + rect.Height, rect.X, rect.Y); break; case BackgroundGradientTypeEnum.HorizontalCenter: // linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.Horizontal); throw new NotSupportedException(); // break; case BackgroundGradientTypeEnum.VerticalCenter: // linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.Vertical); throw new NotSupportedException(); // break; default: break; } gradient.AddColorStop(0, c); gradient.AddColorStop(1, ec); } if (gradient != null) { //// g.FillRectangle(linGrBrush, rect); g.FillRectangle(rect, gradient); gradient.Destroy(); } else if (!si.BackgroundColor.IsEmpty) { g.FillRectangle(rect, c); // g.DrawRoundedRectangle (rect, 2, c, 1); // g.FillRoundedRectangle (rect, 8, c); } g.Restore(); }
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 override void Render(Cairo.Context c) { InvalidateBound (); c.Save (); c.FillRectangle (AbsoluteBound, section.BackgroundColor.ToCairoColor ()); Rectangle r = new Rectangle (AbsoluteBound.X, AbsoluteBound.Y, parentReport.Width, SectionheaderHeight); Cairo.Gradient pat = new Cairo.LinearGradient (0, AbsoluteBound.Y, 0, AbsoluteBound.Y + SectionheaderHeight); pat.AddColorStop (0, sectionHeaderColor); pat.AddColorStop (1, sectionHeaderColor1); c.FillRectangle (r, pat); c.DrawText (new Cairo.PointD (r.X + 3, r.Y + 3), "Tahoma", Cairo.FontSlant.Normal, Cairo.FontWeight.Normal, 11, blackColor, 600, Section.Name); c.FillRectangle (GripperAbsoluteBound, SectionGripperColor); c.Translate (AbsoluteDrawingStartPoint.X, AbsoluteDrawingStartPoint.Y); for (int j = 0; j < Controls.Count; j++) { var ctrl = Controls [j]; ctrl.Render (c); } c.Restore (); }