static void DrawIcon(TextEditor editor, Xwt.Drawing.Context cr, DocumentLine lineSegment, double x, double y, double width, double height) { if (lineSegment.IsBookmarked) { var color1 = editor.ColorStyle.Bookmarks.Color; var color2 = editor.ColorStyle.Bookmarks.SecondColor; DrawRoundRectangle(cr, x + 1, y + 1, 8, width - 4, height - 4); using (var pat = new Xwt.Drawing.LinearGradient(x + width / 4, y, x + width / 2, y + height - 4)) { pat.AddColorStop(0, color1); pat.AddColorStop(1, color2); cr.Pattern = pat; cr.FillPreserve(); } using (var pat = new Xwt.Drawing.LinearGradient(x, y + height, x + width, y)) { pat.AddColorStop(0, color2); //pat.AddColorStop (1, color1); cr.Pattern = pat; cr.Stroke(); } } }
private void DrawBackground(Xwt.Drawing.Context g, Xwt.Rectangle rect, StyleInfo si) { // LinearGradientBrush linGrBrush = null; // SolidBrush sb = null; if (si.BackgroundColor.IsEmpty) return; g.Save(); Xwt.Drawing.Color c = XwtColor.SystemColorToXwtColor(si.BackgroundColor); Xwt.Drawing.Gradient gradient = null; if (si.BackgroundGradientType != BackgroundGradientTypeEnum.None && !si.BackgroundGradientEndColor.IsEmpty) { Xwt.Drawing.Color ec = XwtColor.SystemColorToXwtColor(si.BackgroundGradientEndColor); switch (si.BackgroundGradientType) { case BackgroundGradientTypeEnum.LeftRight: // linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.Horizontal); gradient = new Xwt.Drawing.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 Xwt.Drawing.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 Xwt.Drawing.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 Xwt.Drawing.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) { // TODO: Fix //g.FillRectangle(rect, gradient); } else if (!si.BackgroundColor.IsEmpty) { // TODO: Fix //g.FillRectangle(rect, c); } g.Restore(); }
private void DrawBackground(Xwt.Drawing.Context g, Xwt.Rectangle rect, StyleInfo si) { // LinearGradientBrush linGrBrush = null; // SolidBrush sb = null; if (si.BackgroundColor.IsEmpty) { return; } g.Save(); Xwt.Drawing.Color c = XwtColor.SystemColorToXwtColor(si.BackgroundColor); Xwt.Drawing.Gradient gradient = null; if (si.BackgroundGradientType != BackgroundGradientTypeEnum.None && !si.BackgroundGradientEndColor.IsEmpty) { Xwt.Drawing.Color ec = XwtColor.SystemColorToXwtColor(si.BackgroundGradientEndColor); switch (si.BackgroundGradientType) { case BackgroundGradientTypeEnum.LeftRight: // linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.Horizontal); gradient = new Xwt.Drawing.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 Xwt.Drawing.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 Xwt.Drawing.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 Xwt.Drawing.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) { // TODO: Fix //g.FillRectangle(rect, gradient); } else if (!si.BackgroundColor.IsEmpty) { // TODO: Fix //g.FillRectangle(rect, c); } g.Restore(); }