public int NumeralVariant; //(Integer) The variant of the digit format to use. /// <summary> /// Constructor using all defaults for the style. /// </summary> public StyleInfo() { BColorLeft = BColorRight = BColorTop = BColorBottom = System.Drawing.Color.Black; // (Color) Color of the bottom border BStyleLeft = BStyleRight = BStyleTop = BStyleBottom = BorderStyleEnum.None; // _BorderWdith BWidthLeft = BWidthRight = BWidthTop = BWidthBottom = 1; BackgroundColor = System.Drawing.Color.Empty; BackgroundColorText = string.Empty; BackgroundGradientType = BackgroundGradientTypeEnum.None; BackgroundGradientEndColor = System.Drawing.Color.Empty; BackgroundImage = null; FontStyle = FontStyleEnum.Normal; _FontFamily = "Arial"; FontSize = 10; FontWeight = FontWeightEnum.Normal; TextDecoration = TextDecorationEnum.None; TextAlign = TextAlignEnum.General; VerticalAlign = VerticalAlignEnum.Top; Color = System.Drawing.Color.Black; ColorText = "Black"; PaddingLeft = PaddingRight = PaddingTop = PaddingBottom = 0; LineHeight = 0; Direction = DirectionEnum.LTR; WritingMode = WritingModeEnum.lr_tb; Language = "en-US"; UnicodeBiDirectional = UnicodeBiDirectionalEnum.Normal; Calendar = CalendarEnum.Gregorian; NumeralLanguage = Language; NumeralVariant = 1; }
public int NumeralVariant; //(Integer) The variant of the digit format to use. public StyleInfo() { BColorLeft = BColorRight = BColorTop = BColorBottom = System.Drawing.Color.Black; // (Color) Color of the bottom border BStyleLeft = BStyleRight = BStyleTop = BStyleBottom = BorderStyleEnum.None; // _BorderWdith BWidthLeft = BWidthRight = BWidthTop = BWidthBottom = 1; BackgroundColor = System.Drawing.Color.Empty; BackgroundGradientType = BackgroundGradientTypeEnum.None; BackgroundGradientEndColor = System.Drawing.Color.Empty; BackgroundImage = null; FontStyle = FontStyleEnum.Normal; FontFamily = "Arial"; FontSize = 10; FontWeight = FontWeightEnum.Normal; TextDecoration = TextDecorationEnum.None; TextAlign = TextAlignEnum.Left; VerticalAlign = VerticalAlignEnum.Top; Color = System.Drawing.Color.Black; PaddingLeft = PaddingRight = PaddingTop = PaddingBottom = 0; LineHeight = 0; Direction = DirectionEnum.LTR; WritingMode = WritingModeEnum.lr_tb; Language = "en-US"; UnicodeBiDirectional = UnicodeBiDirectionalEnum.Normal; Calendar = CalendarEnum.Gregorian; NumeralLanguage = Language; NumeralVariant=1; }
string GetBorderName(BorderStyleEnum bs, float width) { string s; switch (bs) { case BorderStyleEnum.Dashed: s = width < 1.2f? "dashed": "mediumDashed"; break; case BorderStyleEnum.Dotted: s = "dotted"; break; case BorderStyleEnum.Double: s = "double"; break; case BorderStyleEnum.None: s = "none"; break; case BorderStyleEnum.Outset: case BorderStyleEnum.Inset: case BorderStyleEnum.Groove: case BorderStyleEnum.Ridge: case BorderStyleEnum.WindowInset: case BorderStyleEnum.Solid: default: s = width < 1.2f? "thin": "medium"; break; } return(s); }
/// <summary> /// Page line element at the X Y to X2 Y2 position /// </summary> /// <returns></returns> internal void AddLine(float x,float y, float x2, float y2, float width, System.Drawing.Color c, BorderStyleEnum ls) { // Get the line color double red=c.R; double green=c.G; double blue=c.B; red = Math.Round((red/255),3); green = Math.Round((green/255),3); blue = Math.Round((blue/255),3); // Get the line style Dotted - Dashed - Solid string linestyle; switch (ls) { case BorderStyleEnum.Dashed: linestyle="[3 2] 0 d"; break; case BorderStyleEnum.Dotted: linestyle="[2] 0 d"; break; case BorderStyleEnum.Solid: default: linestyle="[] 0 d"; break; } elements.AppendFormat(NumberFormatInfo.InvariantInfo, "\r\nq\t{0} w\t{1} {2} {3} RG\t{4}\t{5} {6} m\t{7} {8} l\tS\tQ\t", width, // line width red, green, blue, // line color linestyle, // line style x, pSize.yHeight-y, x2, pSize.yHeight-y2); // positioning }
private void DoInstructions(Single recX, Single recY, Single recWidth, Single recHeight, Pen p) { BorderStyleEnum ls = getLineStyle(p); switch (p.Brush.GetType().Name) { case "SolidBrush": System.Drawing.SolidBrush theBrush = (System.Drawing.SolidBrush)p.Brush; PageRectangle pl = new PageRectangle(); pl.X = X + recX * SCALEFACTOR; pl.Y = Y + recY * SCALEFACTOR; pl.W = recWidth * SCALEFACTOR; pl.H = recHeight * SCALEFACTOR; StyleInfo SI = new StyleInfo(); SI.Color = theBrush.Color; SI.BColorTop = SI.BColorBottom = SI.BColorLeft = SI.BColorRight = theBrush.Color; SI.BStyleTop = SI.BStyleBottom = SI.BStyleLeft = SI.BStyleRight = ls; SI.BWidthTop = SI.BWidthBottom = SI.BWidthLeft = SI.BWidthRight = p.Width * SCALEFACTOR; pl.SI = SI; items.Add(pl); break; default: break; } }
public BorderStyle ConvertBorderStyle(BorderStyleEnum style, short width) { switch (style) { case BorderStyleEnum.None: return(BorderStyle.None); case BorderStyleEnum.Solid: if (width <= 1) { return(BorderStyle.Thin); } if (width == 2) { return(BorderStyle.Medium); } else { return(BorderStyle.Thick); } case BorderStyleEnum.Dotted: return(BorderStyle.Dotted); case BorderStyleEnum.Dashed: return(BorderStyle.Dashed); case BorderStyleEnum.Double: return(BorderStyle.Double); default: return(BorderStyle.Hair); } }
private void DrawLine(Color c, BorderStyleEnum bs, float w, StringBuilder sb, int x, int y, int x2, int y2) { if (bs == BorderStyleEnum.None || c.IsEmpty || w <= 0) // nothing to draw { return; } sb.AppendFormat("<Line X1=\"{0}\" Y1=\"{1}\" X2=\"{2}\" Y2=\"{3}\" Stroke=\"{4}\" StrokeThickness=\"{5}\"", x, y, x2, y2, GetColor(c), w); switch (bs) { case BorderStyleEnum.Dashed: sb.Append(" StrokeDashArray=\"2,2\""); break; case BorderStyleEnum.Dotted: sb.Append(" StrokeDashArray=\"1,1\""); break; default: break; } sb.Append("/>"); }
protected static BorderStyleEnum getLineStyle(Pen p) { BorderStyleEnum ls = BorderStyleEnum.Solid; switch (p.DashStyle) { case DashStyle.Dash: ls = BorderStyleEnum.Dashed; break; case DashStyle.DashDot: ls = BorderStyleEnum.Dashed; break; case DashStyle.DashDotDot: ls = BorderStyleEnum.Dashed; break; case DashStyle.Dot: ls = BorderStyleEnum.Dotted; break; case DashStyle.Solid: ls = BorderStyleEnum.Solid; break; case DashStyle.Custom: ls = BorderStyleEnum.Solid; break; default: break; } return(ls); }
private static void DrawCurve(Color c, BorderStyleEnum bs, float w, Graphics g, PointF[] points, int Offset, float Tension, CanvasProperties cp) { if (bs == BorderStyleEnum.None || c.IsEmpty || w <= 0) // nothing to draw { return; } Pen p = null; try { p = new Pen(c, w); switch (bs) { case BorderStyleEnum.Dashed: p.DashStyle = DashStyle.Dash; break; case BorderStyleEnum.Dotted: p.DashStyle = DashStyle.Dot; break; case BorderStyleEnum.Double: case BorderStyleEnum.Groove: case BorderStyleEnum.Inset: case BorderStyleEnum.Solid: case BorderStyleEnum.Outset: case BorderStyleEnum.Ridge: case BorderStyleEnum.WindowInset: default: p.DashStyle = DashStyle.Solid; break; } PointF[] tmp = new PointF[points.Length]; for (int i = 0; i < points.Length; i++) { tmp[i] = Measurement.PixelsFromPoints(points[i].X + cp.Left - cp.Scroll.X, points[i].Y + cp.Top - cp.Scroll.Y, cp.Dpi); } g.DrawCurve(p, tmp, Offset, tmp.Length - 1, Tension); } finally { if (p != null) { p.Dispose(); } } }
// return the BorderStyleEnum given a particular string value static public BorderStyleEnum GetBorderStyle(string v, BorderStyleEnum def) { BorderStyleEnum bs; switch (v) { case "None": bs = BorderStyleEnum.None; break; case "Dotted": bs = BorderStyleEnum.Dotted; break; case "Dashed": bs = BorderStyleEnum.Dashed; break; case "Solid": bs = BorderStyleEnum.Solid; break; case "Double": bs = BorderStyleEnum.Double; break; case "Groove": bs = BorderStyleEnum.Groove; break; case "Ridge": bs = BorderStyleEnum.Ridge; break; case "Inset": bs = BorderStyleEnum.Inset; break; case "WindowInset": bs = BorderStyleEnum.WindowInset; break; case "Outset": bs = BorderStyleEnum.Outset; break; default: bs = def; break; } return(bs); }
private static void DrawLine(Color c, BorderStyleEnum bs, float w, Graphics g, float x, float y, float x2, float y2) { if (bs == BorderStyleEnum.None || c.IsEmpty || w <= 0) // nothing to draw { return; } Pen p = null; try { //Changed from forum, user :Aleksey http://www.fyireporting.com/forum/viewtopic.php?t=892 float tmpW = w; if (g.PageUnit == GraphicsUnit.Pixel) { tmpW = (tmpW * g.DpiX) / 72; } p = new Pen(c, tmpW); switch (bs) { case BorderStyleEnum.Dashed: p.DashStyle = DashStyle.Dash; break; case BorderStyleEnum.Dotted: p.DashStyle = DashStyle.Dot; break; case BorderStyleEnum.Double: case BorderStyleEnum.Groove: case BorderStyleEnum.Inset: case BorderStyleEnum.Solid: case BorderStyleEnum.Outset: case BorderStyleEnum.Ridge: case BorderStyleEnum.WindowInset: default: p.DashStyle = DashStyle.Solid; break; } g.DrawLine(p, x, y, x2, y2); } finally { if (p != null) { p.Dispose(); } } }
private void DrawLine(Color c, BorderStyleEnum bs, float w, Graphics g, float x, float y, float x2, float y2) { if (bs == BorderStyleEnum.None || c.IsEmpty || w <= 0) // nothing to draw { return; } float tmpW = w; if (g.PageUnit == GraphicsUnit.Pixel) { tmpW = (tmpW * g.DpiX) / 72; } Pen p = new Pen(c, tmpW); try { p = new Pen(c, w); switch (bs) { case BorderStyleEnum.Dashed: p.DashStyle = DashStyle.Dash; break; case BorderStyleEnum.Dotted: p.DashStyle = DashStyle.Dot; break; case BorderStyleEnum.Double: case BorderStyleEnum.Groove: case BorderStyleEnum.Inset: case BorderStyleEnum.Solid: case BorderStyleEnum.Outset: case BorderStyleEnum.Ridge: case BorderStyleEnum.WindowInset: default: p.DashStyle = DashStyle.Solid; break; } g.DrawLine(p, x, y, x2, y2); } finally { if (p != null) { p.Dispose(); } } }
private void DrawCurve(Color c, BorderStyleEnum bs, float w, Graphics g, PointF[] points, int Offset, float Tension) { if (bs == BorderStyleEnum.None || c.IsEmpty || w <= 0) // nothing to draw { return; } Pen p = null; try { p = new Pen(c, w); switch (bs) { case BorderStyleEnum.Dashed: p.DashStyle = DashStyle.Dash; break; case BorderStyleEnum.Dotted: p.DashStyle = DashStyle.Dot; break; case BorderStyleEnum.Double: case BorderStyleEnum.Groove: case BorderStyleEnum.Inset: case BorderStyleEnum.Solid: case BorderStyleEnum.Outset: case BorderStyleEnum.Ridge: case BorderStyleEnum.WindowInset: default: p.DashStyle = DashStyle.Solid; break; } PointF[] tmp = new PointF[points.Length]; for (int i = 0; i < points.Length; i++) { tmp[i].X = PixelsX(points[i].X + _left - _hScroll); tmp[i].Y = PixelsY(points[i].Y + _top - _vScroll); } g.DrawCurve(p, tmp, Offset, tmp.Length - 1, Tension); } finally { if (p != null) { p.Dispose(); } } }
internal RenderObject MakeOwnerDrawCellRO(int row, int col, ref CellStyle cellStyle, ref string text, ref Image image) { bool handled = false; // draw rectangle: Rectangle rc = Rectangle.Empty; rc.Width = Cols[col].WidthDisplay; rc.Height = Rows[row].HeightDisplay; Metafile meta; using (Graphics gRef = Graphics.FromHwnd(IntPtr.Zero)) { IntPtr hdcRef = gRef.GetHdc(); meta = new Metafile(hdcRef, rc, MetafileFrameUnit.Pixel, EmfType.EmfPlusDual); using (Graphics g = Graphics.FromImage(meta)) { // owner-drawing cell borders is not supported: CellBorder cbSave = cellStyle.Border; BorderStyleEnum bsSave = cbSave.Style; IsPrinting = true; OwnerDrawCellEventArgs e = new OwnerDrawCellEventArgs( this, g, row, col, cellStyle, rc, text, image); try { OnOwnerDrawCell(e); } finally { IsPrinting = false; cbSave.Style = bsSave; } handled = e.Handled; if (!handled) { cellStyle = e.Style; text = e.Text; image = e.Image; } } gRef.ReleaseHdc(hdcRef); } if (handled) { return(new RenderImage(meta)); } // release unwanted resources asap: meta.Dispose(); return(null); }
private string GetBorderStyle(BorderStyleEnum borderStyleEnum) { string bs; /* * \brdrs Single-thickness border. * \brdrth Double-thickness border. * \brdrsh Shadowed border. * \brdrdb Double border. * \brdrdot Dotted border. * \brdrdash Dashed border. * \brdrhair Hairline border. * \brdrinset Inset border. * \brdrdashsm Dashed border (small). * \brdrdashd Dot-dashed border. * \brdrdashdd Dot-dot-dashed border. * \brdroutset Outset border. */ switch (borderStyleEnum) { case BorderStyleEnum.Dashed: bs = "brdrdash"; break; case BorderStyleEnum.Dotted: bs = "brdrdot"; break; case BorderStyleEnum.Double: bs = "brdrdb"; break; case BorderStyleEnum.Inset: bs = "brdrinset"; break; case BorderStyleEnum.None: bs = "brdrnil"; break; case BorderStyleEnum.Outset: bs = "brdroutset"; break; case BorderStyleEnum.Ridge: case BorderStyleEnum.Solid: case BorderStyleEnum.Groove: default: bs = "brdrs"; break; } return(bs); }
private void DrawLine(Cairo.Color c, BorderStyleEnum bs, float w, Cairo.Context g, double x, double y, double x2, double y2) { if (bs == BorderStyleEnum.None ||//|| c.IsEmpty w <= 0) // nothing to draw { return; } g.Save(); // Pen p = null; // p = new Pen(c, w); g.Color = c; g.LineWidth = w; switch (bs) { case BorderStyleEnum.Dashed: // p.DashStyle = DashStyle.Dash; g.SetDash(new double[] { 2, 1 }, 0.0); break; case BorderStyleEnum.Dotted: // p.DashStyle = DashStyle.Dot; g.SetDash(new double[] { 1 }, 0.0); break; case BorderStyleEnum.Double: case BorderStyleEnum.Groove: case BorderStyleEnum.Inset: case BorderStyleEnum.Solid: case BorderStyleEnum.Outset: case BorderStyleEnum.Ridge: case BorderStyleEnum.WindowInset: default: g.SetDash(new double[] { }, 0.0); break; } // g.DrawLine(p, x, y, x2, y2); g.MoveTo(x, y); g.LineTo(x2, y2); g.Stroke(); g.Restore(); }
private void DoInstructions(PointF[] points, Pen p, UInt32 Offset, UInt32 NumberOfPoints, float Tension) { BorderStyleEnum ls = getLineStyle(p); //Well we only draw lines at the moment.... switch (p.Brush.GetType().Name) { case "SolidBrush": System.DrawingCore.SolidBrush theBrush = (System.DrawingCore.SolidBrush)p.Brush; PageCurve pc = new PageCurve(); for (int i = 0; i < points.Length; i++) { points[i].X = X + points[i].X * SCALEFACTOR; points[i].Y = Y + points[i].Y * SCALEFACTOR; } pc.Points = points; pc.Offset = (int)Offset; pc.Tension = Tension; StyleInfo SI = new StyleInfo(); SI.Color = theBrush.Color; SI.BColorTop = theBrush.Color; SI.BStyleTop = ls; SI.BWidthTop = p.Width * SCALEFACTOR; SI.BColorBottom = theBrush.Color; SI.BStyleBottom = ls; SI.BWidthBottom = p.Width * SCALEFACTOR; SI.BColorLeft = theBrush.Color; SI.BStyleLeft = ls; SI.BWidthLeft = p.Width * SCALEFACTOR; SI.BColorRight = theBrush.Color; SI.BStyleRight = ls; SI.BWidthRight = p.Width * SCALEFACTOR; pc.SI = SI; items.Add(pc); break; default: break; } }
public int NumeralVariant; //(Integer) The variant of the digit format to use. /// <summary> /// Constructor using all defaults for the style. /// </summary> public StyleInfo() { BColorLeft = BColorRight = BColorTop = BColorBottom = System.Drawing.Color.Black; // (Color) Color of the bottom border BStyleLeft = BStyleRight = BStyleTop = BStyleBottom = BorderStyleEnum.None; // _BorderWdith BWidthLeft = BWidthRight = BWidthTop = BWidthBottom = 1; BackgroundColor = System.Drawing.Color.Empty; BackgroundColorText = string.Empty; BackgroundGradientType = BackgroundGradientTypeEnum.None; BackgroundGradientEndColor = System.Drawing.Color.Empty; BackgroundImage = null; FontStyle = FontStyleEnum.Normal; _FontFamily = "Arial"; //WRP 291008 numFmtId should be 0 (Zero) for General format - will be interpreted as a string //It has default values in Excel07 as per ECMA-376 standard (SEction 3.8.30) for Office Open XML Excel07 _Format = "General"; FontSize = 10; FontWeight = FontWeightEnum.Normal; PatternType = patternTypeEnum.None; TextDecoration = TextDecorationEnum.None; TextAlign = TextAlignEnum.General; VerticalAlign = VerticalAlignEnum.Top; Color = System.Drawing.Color.Black; ColorText = "Black"; PaddingLeft = PaddingRight = PaddingTop = PaddingBottom = 0; LineHeight = 0; Direction = DirectionEnum.LTR; WritingMode = WritingModeEnum.lr_tb; Language = "en-US"; UnicodeBiDirectional = UnicodeBiDirectionalEnum.Normal; Calendar = CalendarEnum.Gregorian; NumeralLanguage = Language; NumeralVariant = 1; }
private void DoInstructions(Single Xa, Single Xb, Single Ya, Single Yb, Pen p) { BorderStyleEnum ls = getLineStyle(p); switch (p.Brush.GetType().Name) { case "SolidBrush": System.Drawing.SolidBrush theBrush = (System.Drawing.SolidBrush)p.Brush; PageLine pl = new PageLine(); pl.X = X + Xa * SCALEFACTOR; pl.Y = Y + Ya * SCALEFACTOR; pl.X2 = X + Xb * SCALEFACTOR; pl.Y2 = Y + Yb * SCALEFACTOR; StyleInfo SI = new StyleInfo(); SI.Color = theBrush.Color; SI.BColorTop = theBrush.Color; SI.BStyleTop = ls; SI.BWidthTop = p.Width * SCALEFACTOR; SI.BColorBottom = theBrush.Color; SI.BStyleBottom = ls; SI.BWidthBottom = p.Width * SCALEFACTOR; SI.BColorLeft = theBrush.Color; SI.BStyleLeft = ls; SI.BWidthLeft = p.Width * SCALEFACTOR; SI.BColorRight = theBrush.Color; SI.BStyleRight = ls; SI.BWidthRight = p.Width * SCALEFACTOR; pl.SI = SI; items.Add(pl); break; default: break; } }
private void DoEllipse(Pen p, Single Xp, Single Yp, Single Wid, Single Hgt) { BorderStyleEnum ls = getLineStyle(p); Color col = Color.Black; if (p.Brush.GetType().Name.Equals("SolidBrush")) { System.DrawingCore.SolidBrush theBrush = (System.DrawingCore.SolidBrush)p.Brush; col = theBrush.Color; } PageEllipse pl = new PageEllipse(); pl.X = X + Xp * SCALEFACTOR; pl.Y = Y + Yp * SCALEFACTOR; pl.W = Wid * SCALEFACTOR; pl.H = Hgt * SCALEFACTOR; StyleInfo SI = new StyleInfo(); SI.Color = col; SI.BColorTop = col; SI.BStyleTop = ls; SI.BWidthTop = p.Width * SCALEFACTOR; pl.SI = SI; items.Add(pl); //Lines.AppendFormat("\r\n"); //CrLf //Lines.AppendFormat("q\t"); //Push graphics state onto stack //Lines.AppendFormat("{0} w\t", p.Width * ScaleX); //set width of path //Lines.AppendFormat("{0} \t", linestyle); //line style from pen... //Lines.AppendFormat("{0} {1} {2} RG\t", Math.Round(R / 255.0, 3), Math.Round(G / 255.0, 3), Math.Round(B / 255.0, 3)); //Set RGB colours //Lines.AppendFormat("{0} {1} {2} rg\t", Math.Round(R / 255.0, 3), Math.Round(G / 255.0, 3), Math.Round(B / 255.0, 3)); //Set RGB colours ////Need some bezier curves to draw an ellipse.. we can't draw a circle, but we can get close. //Double k = 0.5522847498; //Double RadiusX = (Wid / 2.0) * ScaleX; //Double RadiusY = (Hgt / 2.0) * ScaleY; //Double Y4 = Y + Height - Yp * ScaleY; //Double X1 = Xp * ScaleX + X; //Double Y1 = Y4 - RadiusY; //Double X4 = X1 + RadiusX; //Lines.AppendFormat("{0} {1} m\t", X1, Y1);//FirstPoint.. //Double kRy = k * RadiusY; //Double kRx = k * RadiusX; ////Control Point 1 will be on the same X as point 1 and be -kRy Y //Double X2 = X1; //Double Y2 = Y1 + kRy; //Double X3 = X4 - kRx; //Double Y3 = Y4; //Lines.AppendFormat("{0} {1} {2} {3} {4} {5} c\t", X2, Y2, X3, Y3, X4, Y4); //Upper Left Quadrant //X1 += 2 * RadiusX; //X2 = X1; //X3 += 2 * kRx; //Lines.AppendFormat("{0} {1} {2} {3} {4} {5} c\t", X3, Y3, X2, Y2, X1, Y1); //Upper Right Quadrant //Y2 -= 2 * kRy; //Y3 -= 2 * RadiusY; //Y4 = Y3; //Lines.AppendFormat("{0} {1} {2} {3} {4} {5} c\t", X2, Y2, X3, Y3, X4, Y4); //Lower Right Quadrant //X1 -= 2 * RadiusX; //X2 = X1; //X3 -= 2 * kRx; //Lines.AppendFormat("{0} {1} {2} {3} {4} {5} c\t", X3, Y3, X2, Y2, X1, Y1); //Lower Right Quadrant //Lines.AppendFormat("S\t");//Stroke path //Lines.AppendFormat("Q\t");//Pop graphics state from stack }
/// <summary> /// Page line element at the X Y to X2 Y2 position /// </summary> /// <returns></returns> private void addLine(float x, float y, float x2, float y2, float width, Color color, BorderStyleEnum borderStyle) { //set the line color and width pdfContent.SetRGBColorStroke(color.R, color.G, color.B); pdfContent.SetLineWidth(width / 2); //set the line style Dotted - Dashed - Solid (default) switch (borderStyle) { case BorderStyleEnum.Dotted: pdfContent.SetLineDash(new float[] { '2' }, 0); break; case BorderStyleEnum.Dashed: pdfContent.SetLineDash(new float[] { '3', '2' }, 0); break; default: pdfContent.SetLineDash(new float[] { }, 0); break; } //designe the line pdfContent.MoveTo(x, pageHeight - y); pdfContent.LineTo(x2, pageHeight - y2); pdfContent.Stroke(); }
private void DrawLine(Color c, BorderStyleEnum bs, float w, Graphics g, float x, float y, float x2, float y2) { if (bs == BorderStyleEnum.None || c.IsEmpty || w <= 0) // nothing to draw return; float tmpW = w; if (g.PageUnit == GraphicsUnit.Pixel) tmpW = (tmpW * g.DpiX) / 72; Pen p = new Pen(c, tmpW); try { p = new Pen(c, w); switch (bs) { case BorderStyleEnum.Dashed: p.DashStyle = DashStyle.Dash; break; case BorderStyleEnum.Dotted: p.DashStyle = DashStyle.Dot; break; case BorderStyleEnum.Double: case BorderStyleEnum.Groove: case BorderStyleEnum.Inset: case BorderStyleEnum.Solid: case BorderStyleEnum.Outset: case BorderStyleEnum.Ridge: case BorderStyleEnum.WindowInset: default: p.DashStyle = DashStyle.Solid; break; } g.DrawLine(p, x, y, x2, y2); } finally { if (p != null) p.Dispose(); } }
BorderStyleValues GetBorderStyle(BorderStyleEnum bs) { BorderStyleValues s; switch (bs) { case BorderStyleEnum.Solid: s = BorderStyleValues.Thin; break; case BorderStyleEnum.Dashed: s = BorderStyleValues.Dashed; break; case BorderStyleEnum.Dotted: s = BorderStyleValues.Dotted; break; case BorderStyleEnum.Double: s = BorderStyleValues.Double; break; case BorderStyleEnum.None: s = BorderStyleValues.None; break; default: s = BorderStyleValues.Thin; break; } return s; }
public void SetBorderTop(BorderStyleEnum style, float width, Color color) { borderTopColor = color; borderTop = style; borderTopWidth = (short)width; }
public void SetBorderBottom(BorderStyleEnum style, float width, Color color) { borderBottomColor = color; borderBottom = style; borderBottomWidth = (short)width; }
protected internal override void AddLine(float x, float y, float x2, float y2, float width, System.Drawing.Color c, BorderStyleEnum ls) { // Get the line color _contentByte.SetRGBColorStroke(c.R, c.G, c.B); _contentByte.SetLineWidth(width); // Get the line style Dotted - Dashed - Solid switch (ls) { case BorderStyleEnum.Dashed: _contentByte.SetLineDash(new float[] { width * 3, width }, 0); break; case BorderStyleEnum.Dotted: _contentByte.SetLineDash(new float[] { width }, 0); break; case BorderStyleEnum.Solid: default: _contentByte.SetLineDash(new float[] { }, 0); break; } _contentByte.MoveTo(x, PageSize.yHeight - y); _contentByte.LineTo(x2, PageSize.yHeight - y2); _contentByte.Stroke(); }
public void SetBorderLeft(BorderStyleEnum style, float width, Color color) { borderLeftColor = color; borderLeft = style; borderLeftWidth = (short)width; }
private void DrawLine(Color c, BorderStyleEnum bs, float w, StringBuilder sb, int x, int y, int x2, int y2) { if (bs == BorderStyleEnum.None || c.IsEmpty || w <= 0) // nothing to draw return; //PJR fix StrokeThickness sb.AppendFormat("<Line X1=\"{0}\" Y1=\"{1}\" X2=\"{2}\" Y2=\"{3}\" Stroke=\"{4}\" StrokeThickness=\"{5}\"", x, y, x2, y2, GetColor(c),(int)(w+0.25)); switch (bs) { case BorderStyleEnum.Dashed: sb.Append(" StrokeDashArray=\"2,2\""); break; case BorderStyleEnum.Dotted: sb.Append(" StrokeDashArray=\"1,1\""); break; default: break; } sb.Append("/>"); }
internal abstract protected void AddLine(float x, float y, float x2, float y2, float width, System.DrawingCore.Color c, BorderStyleEnum ls);
private void DrawLine(Color c, BorderStyleEnum bs, float w, Graphics g, float x, float y, float x2, float y2) { if (bs == BorderStyleEnum.None || c.IsEmpty || w <= 0) // nothing to draw return; float widthPen = w; if (g.PageUnit == GraphicsUnit.Pixel) widthPen=RDL.Utility.Measurement.PixelsFromPoints(w, g.DpiX); using (Pen p = new Pen(c, widthPen)) { switch (bs) { case BorderStyleEnum.Dashed: p.DashStyle = DashStyle.Dash; break; case BorderStyleEnum.Dotted: p.DashStyle = DashStyle.Dot; break; case BorderStyleEnum.Double: case BorderStyleEnum.Groove: case BorderStyleEnum.Inset: case BorderStyleEnum.Solid: case BorderStyleEnum.Outset: case BorderStyleEnum.Ridge: case BorderStyleEnum.WindowInset: default: p.DashStyle = DashStyle.Solid; break; } g.DrawLine(p, x, y, x2, y2); } }
private void DrawBorderDashStyle(Pen p, BorderStyleEnum bs) { switch (bs) { case BorderStyleEnum.Dashed: p.DashStyle = DashStyle.Dash; break; case BorderStyleEnum.Dotted: p.DashStyle = DashStyle.Dot; break; case BorderStyleEnum.Double: p.DashStyle = DashStyle.Solid; // TODO: really need to create custom? break; case BorderStyleEnum.Groove: p.DashStyle = DashStyle.Solid; // TODO: break; case BorderStyleEnum.Inset: p.DashStyle = DashStyle.Solid; // TODO: break; case BorderStyleEnum.None: p.DashStyle = DashStyle.Solid; // only happens for lines break; case BorderStyleEnum.Outset: p.DashStyle = DashStyle.Solid; // TODO: break; case BorderStyleEnum.Ridge: p.DashStyle = DashStyle.Solid; // TODO: break; case BorderStyleEnum.Solid: p.DashStyle = DashStyle.Solid; break; case BorderStyleEnum.WindowInset: p.DashStyle = DashStyle.Solid; // TODO: break; default: p.DashStyle = DashStyle.Solid; // really an error break; } return; }
protected internal abstract void AddLine(float x, float y, float x2, float y2, float width, System.Drawing.Color c, BorderStyleEnum ls);
/// <summary> /// Page line element at the X Y to X2 Y2 position /// </summary> /// <returns></returns> internal void AddLine(float x, float y, float x2, float y2, float width, System.Drawing.Color c, BorderStyleEnum ls) { // Get the line color double red = c.R; double green = c.G; double blue = c.B; red = Math.Round((red / 255), 3); green = Math.Round((green / 255), 3); blue = Math.Round((blue / 255), 3); // Get the line style Dotted - Dashed - Solid string linestyle; switch (ls) { case BorderStyleEnum.Dashed: linestyle = "[3 2] 0 d"; break; case BorderStyleEnum.Dotted: linestyle = "[2] 0 d"; break; case BorderStyleEnum.Solid: default: linestyle = "[] 0 d"; break; } elements.AppendFormat(NumberFormatInfo.InvariantInfo, "\r\nq\t{0} w\t{1} {2} {3} RG\t{4}\t{5} {6} m\t{7} {8} l\tS\tQ\t", width, // line width red, green, blue, // line color linestyle, // line style x, pSize.yHeight - y, x2, pSize.yHeight - y2); // positioning }
/// <summary> /// Page line element at the X Y to X2 Y2 position /// </summary> /// <returns></returns> private void iAddLine(float x, float y, float x2, float y2, float width, System.Drawing.Color c, BorderStyleEnum ls) { // Get the line color cb.SetRGBColorStroke(c.R, c.G, c.B); cb.SetLineWidth(width); // Get the line style Dotted - Dashed - Solid switch (ls) { case BorderStyleEnum.Dashed: cb.SetLineDash(new float[] { width*3, width }, 0); break; case BorderStyleEnum.Dotted: cb.SetLineDash(new float[] { width },0); break; case BorderStyleEnum.Solid: default: cb.SetLineDash(new float[] { }, 0); break; } cb.MoveTo(x, _pSize.yHeight - y); cb.LineTo(x2, _pSize.yHeight - y2); cb.Stroke(); }
public void SetBorderLeft(BorderStyleEnum style) { SetBorderLeft(style, 1, Color.Black); }
public void SetBorderBottom(BorderStyleEnum style) { SetBorderBottom(style, 1, Color.Black); }
private string GetBorderStyle(BorderStyleEnum borderStyleEnum) { string bs; /* \brdrs Single-thickness border. \brdrth Double-thickness border. \brdrsh Shadowed border. \brdrdb Double border. \brdrdot Dotted border. \brdrdash Dashed border. \brdrhair Hairline border. \brdrinset Inset border. \brdrdashsm Dashed border (small). \brdrdashd Dot-dashed border. \brdrdashdd Dot-dot-dashed border. \brdroutset Outset border. */ switch (borderStyleEnum) { case BorderStyleEnum.Dashed: bs = "brdrdash"; break; case BorderStyleEnum.Dotted: bs = "brdrdot"; break; case BorderStyleEnum.Double: bs = "brdrdb"; break; case BorderStyleEnum.Inset: bs = "brdrinset"; break; case BorderStyleEnum.None: bs = "brdrnil"; break; case BorderStyleEnum.Outset: bs = "brdroutset"; break; case BorderStyleEnum.Ridge: case BorderStyleEnum.Solid: case BorderStyleEnum.Groove: default: bs = "brdrs"; break; } return bs; }
private void DrawLine(Xwt.Drawing.Color c, BorderStyleEnum bs, float w, Xwt.Drawing.Context g, double x, double y, double x2, double y2) { if (bs == BorderStyleEnum.None //|| c.IsEmpty || w <= 0) // nothing to draw return; g.Save(); // Pen p = null; // p = new Pen(c, w); g.SetColor(c); g.SetLineWidth(w); switch (bs) { case BorderStyleEnum.Dashed: // p.DashStyle = DashStyle.Dash; g.SetLineDash(0.0, new double[] { 2, 1 }); break; case BorderStyleEnum.Dotted: // p.DashStyle = DashStyle.Dot; g.SetLineDash(0.0, new double[] { 1 }); break; case BorderStyleEnum.Double: case BorderStyleEnum.Groove: case BorderStyleEnum.Inset: case BorderStyleEnum.Solid: case BorderStyleEnum.Outset: case BorderStyleEnum.Ridge: case BorderStyleEnum.WindowInset: default: g.SetLineDash(0.0, new double[] { }); break; } g.MoveTo(x, y); g.LineTo(x2, y2); g.Stroke(); g.Restore(); }
private void DrawCurve(Color c, BorderStyleEnum bs, float w, Graphics g, PointF[] points, int Offset, float Tension) { if (bs == BorderStyleEnum.None || c.IsEmpty || w <= 0) // nothing to draw return; Pen p = null; try { p = new Pen(c, w); switch (bs) { case BorderStyleEnum.Dashed: p.DashStyle = DashStyle.Dash; break; case BorderStyleEnum.Dotted: p.DashStyle = DashStyle.Dot; break; case BorderStyleEnum.Double: case BorderStyleEnum.Groove: case BorderStyleEnum.Inset: case BorderStyleEnum.Solid: case BorderStyleEnum.Outset: case BorderStyleEnum.Ridge: case BorderStyleEnum.WindowInset: default: p.DashStyle = DashStyle.Solid; break; } PointF[] tmp = new PointF[points.Length]; for (int i = 0; i < points.Length; i++) { tmp[i].X = PixelsX(points[i].X + _left - _hScroll); tmp[i].Y = PixelsY(points[i].Y + _top - _vScroll); } g.DrawCurve(p, tmp, Offset, tmp.Length - 1, Tension); } finally { if (p != null) p.Dispose(); } }
protected internal override void AddLine(float x, float y, float x2, float y2, float width, System.DrawingCore.Color c, BorderStyleEnum ls) { // Get the line color _contentByte.SetRgbColorStroke(c.R, c.G, c.B); _contentByte.SetLineWidth(width); // Get the line style Dotted - Dashed - Solid switch (ls) { case BorderStyleEnum.Dashed: _contentByte.SetLineDash(new float[] { width * 3, width }, 0); break; case BorderStyleEnum.Dotted: _contentByte.SetLineDash(new float[] { width }, 0); break; case BorderStyleEnum.Solid: default: _contentByte.SetLineDash(new float[] { }, 0); break; } _contentByte.MoveTo(x, PageSize.yHeight - y); _contentByte.LineTo(x2, PageSize.yHeight - y2); _contentByte.Stroke(); }
public int NumeralVariant; //(Integer) The variant of the digit format to use. /// <summary> /// Constructor using all defaults for the style. /// </summary> public StyleInfo() { BColorLeft = BColorRight = BColorTop = BColorBottom = System.Drawing.Color.Black; // (Color) Color of the bottom border BStyleLeft = BStyleRight = BStyleTop = BStyleBottom = BorderStyleEnum.None; // _BorderWdith BWidthLeft = BWidthRight = BWidthTop = BWidthBottom = 1; BackgroundColor = System.Drawing.Color.Empty; BackgroundColorText = string.Empty; BackgroundGradientType = BackgroundGradientTypeEnum.None; BackgroundGradientEndColor = System.Drawing.Color.Empty; BackgroundImage = null; FontStyle = FontStyleEnum.Normal; _FontFamily = "Arial"; //WRP 291008 numFmtId should be 0 (Zero) for General format - will be interpreted as a string //It has default values in Excel07 as per ECMA-376 standard (SEction 3.8.30) for Office Open XML Excel07 _Format = "General"; FontSize = 10; FontWeight = FontWeightEnum.Normal; PatternType = patternTypeEnum.None; TextDecoration = TextDecorationEnum.None; TextAlign = TextAlignEnum.General; VerticalAlign = VerticalAlignEnum.Top; Color = System.Drawing.Color.Black; ColorText = "Black"; PaddingLeft = PaddingRight = PaddingTop = PaddingBottom = 0; LineHeight = 0; Direction = DirectionEnum.LTR; WritingMode = WritingModeEnum.lr_tb; Language = "en-US"; UnicodeBiDirectional = UnicodeBiDirectionalEnum.Normal; Calendar = CalendarEnum.Gregorian; NumeralLanguage = Language; NumeralVariant=1; }
// return the BorderStyleEnum given a particular string value static internal BorderStyleEnum GetBorderStyle(string v, BorderStyleEnum def) { BorderStyleEnum bs; switch (v) { case "None": bs = BorderStyleEnum.None; break; case "Dotted": bs = BorderStyleEnum.Dotted; break; case "Dashed": bs = BorderStyleEnum.Dashed; break; case "Solid": bs = BorderStyleEnum.Solid; break; case "Double": bs = BorderStyleEnum.Double; break; case "Groove": bs = BorderStyleEnum.Groove; break; case "Ridge": bs = BorderStyleEnum.Ridge; break; case "Inset": bs = BorderStyleEnum.Inset; break; case "WindowInset": bs = BorderStyleEnum.WindowInset; break; case "Outset": bs = BorderStyleEnum.Outset; break; default: bs = def; break; } return bs; }