public TextBorders(BorderStyle bs, BorderSize sz, Color bc, int space = 0) { borderStyle = bs; borderWidth = sz; borderColor = bc; borderSpace = space; }
public BorderConfig() { m_BorderType = BorderType.NoneBorderType; m_BorderSize = BorderSize.NoneBorderSize; m_BarcodeConfigInfo = new BarcodeConfigInfo(); m_StampConfigInfos = new List <StampConfigInfo>(); }
public Border(BorderStyle tcbs, BorderSize size, int space, Color color) { this.Tcbs = tcbs; this.Size = size; this.Space = space; this.Color = color; }
/// <summary> /// Starts the new size rule. /// </summary> /// <param name="borderSize">Border size to be applied.</param> /// <returns>Next rule reference.</returns> public IFluentBorderWithAll WithSize(BorderSize borderSize) { if (rules == null) { rules = new Dictionary <BorderSize, List <BorderDefinition> >(); } var borderDefinition = new BorderDefinition { Side = BorderSide.All }; if (!rules.ContainsKey(borderSize)) { rules.Add(borderSize, new List <BorderDefinition> { borderDefinition }); } else { rules[borderSize].Add(borderDefinition); } currentBorderDefinition = borderDefinition; Dirty(); return(this); }
public static RectangleF ResizedBy( this RectangleF me, BorderSize bs, Point2?minimum_size = null ) { if (minimum_size == null) { return(new RectangleF( me.X - bs.Left, me.Y - bs.Top, me.Width + bs.Left + bs.Right, me.Height + bs.Top + bs.Bottom )); } if (bs.Top < minimum_size.Value.Y - me.Height) { bs = bs.SetTop(minimum_size.Value.Y - me.Height); } if (bs.Left < minimum_size.Value.X - me.Width) { bs = bs.SetLeft(minimum_size.Value.X - me.Width); } return(new RectangleF( me.X - bs.Left, me.Y - bs.Top, me.Width + bs.Left + bs.Right, me.Height + bs.Top + bs.Bottom ).WithMinimumSize(minimum_size.Value)); }
public Border(BorderStyle tcbs, BorderSize size, int space, Color color) { this.Tcbs = tcbs; this.Size = size; this.Space = space; this.Color = color; }
public Border(BorderStyle tcbs, BorderSize size, int space, Color color) { Tcbs = tcbs; Size = size; Space = space; Color = color; }
public override int GetHashCode() { return(base.GetHashCode() ^ Texture.GetHashCode() ^ BorderSize.GetHashCode() ^ TextureUVMin.GetHashCode() ^ TextureUVMax.GetHashCode()); }
static Comm() { DefaultBlendable = true; DefaultBackColor = Color.Azure; DefaultForeColor = Color.Purple; DefaultBorderColor = Color.DarkGreen; DefaultOpacity = 0.85f; DefaultBorderSize = new BorderSize(4, 2, 4, 4); }
public static RectangleF ResizedBy( this RectangleF me, RectanglePart part ) { var resize = new BorderSize( me.Height * -(1f - part.Indents.Up), me.Height * -(1f - part.Indents.Down), me.Width * -(1f - part.Indents.Left), me.Width * -(1f - part.Indents.Right) ); return(me.ResizedBy(resize)); }
public BorderConfig GetBorderConfig(BorderType type, BorderSize size) { BorderConfig reVal = null; foreach (BorderConfig item in m_lst_BorderConfig) { if (item.m_BorderType == type && item.m_BorderSize == size) { reVal = item; break; } } return(reVal); }
private void updateFormSize() { int columnsCount = (int)Math.Ceiling(Math.Sqrt(_layoutPanel.Controls.Count)); int rowsCount = columnsCount != 0 ? (int)Math.Ceiling((float)_layoutPanel.Controls.Count / columnsCount) : 0; var cellCount = new Size(columnsCount, rowsCount); Size = BorderSize.MultiplyBy(new Size(2, 1)) .Plus(new Size(0, CaptionHeight)) .Plus(_layoutPanel.Margin.Size) .Plus(_cellMargin.Size.MultiplyBy(cellCount)) .Plus(_cellSize.MultiplyBy(cellCount)); }
internal static string GetNumericSize(BorderSize borderSize) { var size = "2"; switch (borderSize) { case BorderSize.two: size = "4"; break; case BorderSize.three: size = "6"; break; case BorderSize.four: size = "8"; break; case BorderSize.five: size = "12"; break; case BorderSize.six: size = "18"; break; case BorderSize.seven: size = "24"; break; case BorderSize.eight: size = "36"; break; case BorderSize.nine: size = "48"; break; case BorderSize.one: default: size = "2"; break; } return(size); }
public override void OnDraw(Graphics g) { Brush brush = null; Pen pen = null; try { if (FillColor.A > 0) { brush = new SolidBrush(FillColor); } if (BorderSize > 0 && BorderColor.A > 0) { pen = new Pen(BorderColor, BorderSize); } if (CornerRadius > 0) { g.SmoothingMode = SmoothingMode.HighQuality; if (BorderSize.IsEvenNumber()) { g.PixelOffsetMode = PixelOffsetMode.Half; } } g.DrawRoundedRectangle(brush, pen, Rectangle, CornerRadius); g.SmoothingMode = SmoothingMode.None; g.PixelOffsetMode = PixelOffsetMode.Default; } finally { if (brush != null) { brush.Dispose(); } if (pen != null) { pen.Dispose(); } } }
public override String ToString() { StringBuilder sb = new StringBuilder(); sb.Append($"{DocumentIdentifier},"); sb.Append($"{FileOrder},"); sb.Append($"{X},"); sb.Append($"{Y},"); sb.Append($"{Width},"); sb.Append($"{Height},"); sb.Append($"{MarkupType},"); sb.Append($"{(FillA == null ? "null" : FillA.ToString())},"); sb.Append($"{(FillR == null ? "null" : FillR.ToString())},"); sb.Append($"{(FillG == null ? "null" : FillG.ToString())},"); sb.Append($"{(FillB == null ? "null" : FillB.ToString())},"); sb.Append($"{(BorderSize == null ? "null" : BorderSize.ToString())},"); sb.Append($"{(BorderA == null ? "null" : BorderA.ToString())},"); sb.Append($"{(BorderR == null ? "null" : BorderR.ToString())},"); sb.Append($"{(BorderG == null ? "null" : BorderG.ToString())},"); sb.Append($"{(BorderB == null ? "null" : BorderB.ToString())},"); sb.Append($"{(BorderStyle == null ? "null" : BorderStyle.ToString())},"); sb.Append($"{FontName},"); sb.Append($"{(FontA == null ? "null" : FontA.ToString())},"); sb.Append($"{(FontR == null ? "null" : FontR.ToString())},"); sb.Append($"{(FontG == null ? "null" : FontG.ToString())},"); sb.Append($"{(FontB == null ? "null" : FontB.ToString())},"); sb.Append($"{(FontSize == null ? "null" : FontSize.ToString())},"); sb.Append($"{(FontStyle == null ? "null" : FontStyle.ToString())},"); sb.Append($"{Text},"); sb.Append($"{ZOrder},"); String drawCrossLinesValue = DrawCrossLines ? "1" : "0"; sb.Append($"{drawCrossLinesValue},"); sb.Append($"{MarkupSubType},"); sb.Append($"{(Xd == null ? "null" : Xd.ToString())},"); sb.Append($"{(Yd == null ? "null" : Yd.ToString())},"); sb.Append($"{(WidthD == null ? "null" : WidthD.ToString())},"); sb.Append($"{(HeightD == null ? "null" : HeightD.ToString())}"); String retVal = sb.ToString(); return(retVal); }
public BorderConfig GetBorderConfig(string strType, string strSize) { strSize = strSize.Substring(0, 2); BorderType type = BorderType.HORIZONTAL; BorderSize size = BorderSize.A0; if (strType == "竖框") { type = BorderType.VERTICAL; } if (strSize.ToUpper() == "A0") { size = BorderSize.A0; } if (strSize.ToUpper() == "A1") { size = BorderSize.A1; } if (strSize.ToUpper() == "A2") { size = BorderSize.A2; } if (strSize.ToUpper() == "A3") { size = BorderSize.A3; } if (strSize.ToUpper() == "A4") { size = BorderSize.A4; } BorderConfig reVal = null; foreach (BorderConfig item in m_lst_BorderConfig) { if (item.m_BorderType == type && item.m_BorderSize == size) { reVal = item; break; } } return(reVal); }
public void Save() { string[] values = new string[17]; values[0] = name; values[1] = imagePath; values[2] = anchor.ToString(); values[3] = increment.ToString(); values[4] = xPos.ToString(); values[5] = yPos.ToString(); values[6] = lastUsed.ToString(); values[7] = FontName; values[8] = FontSize.ToString(); values[9] = IsBold.ToString(); values[10] = IsCursive.ToString(); values[11] = FontColor.ToArgb().ToString(); values[12] = BorderSize.ToString(); values[13] = BorderColor.ToArgb().ToString(); DataHelper.SaveData(values, name); }
public override void OnDraw(Graphics g) { if (BorderSize > 0 && BorderColor.A > 0) { g.SmoothingMode = SmoothingMode.HighQuality; if (BorderSize.IsEvenNumber()) { g.PixelOffsetMode = PixelOffsetMode.Half; } using (Pen pen = new Pen(BorderColor, BorderSize)) { DrawLine(g, pen); } g.SmoothingMode = SmoothingMode.None; g.PixelOffsetMode = PixelOffsetMode.Default; } }
public String ToStringRedactionData() { StringBuilder sb = new StringBuilder(); sb.Append($"{nameof(FileOrder)}: {FileOrder}, "); sb.Append($"{nameof(X)}: {X}, "); sb.Append($"{nameof(Y)}: {Y}, "); sb.Append($"{nameof(Width)}: {Width}, "); sb.Append($"{nameof(Height)}: {Height}, "); sb.Append($"{nameof(MarkupType)}: {MarkupType}, "); sb.Append($"{nameof(FillA)}: {(FillA == null ? "null" : FillA.ToString())}, "); sb.Append($"{nameof(FillR)}: {(FillR == null ? "null" : FillR.ToString())}, "); sb.Append($"{nameof(FillG)}: {(FillG == null ? "null" : FillG.ToString())}, "); sb.Append($"{nameof(FillB)}: {(FillB == null ? "null" : FillB.ToString())}, "); sb.Append($"{nameof(BorderSize)}: {(BorderSize == null ? "null" : BorderSize.ToString())}, "); sb.Append($"{nameof(BorderA)}: {(BorderA == null ? "null" : BorderA.ToString())}, "); sb.Append($"{nameof(BorderR)}: {(BorderR == null ? "null" : BorderR.ToString())}, "); sb.Append($"{nameof(BorderG)}: {(BorderG == null ? "null" : BorderG.ToString())}, "); sb.Append($"{nameof(BorderB)}: {(BorderB == null ? "null" : BorderB.ToString())}, "); sb.Append($"{nameof(BorderStyle)}: {(BorderStyle == null ? "null" : BorderStyle.ToString())}, "); sb.Append($"{nameof(FontName)}: {FontName}, "); sb.Append($"{nameof(FontA)}: {(FontA == null ? "null" : FontA.ToString())}, "); sb.Append($"{nameof(FontR)}: {(FontR == null ? "null" : FontR.ToString())}, "); sb.Append($"{nameof(FontG)}: {(FontG == null ? "null" : FontG.ToString())}, "); sb.Append($"{nameof(FontB)}: {(FontB == null ? "null" : FontB.ToString())}, "); sb.Append($"{nameof(FontSize)}: {(FontSize == null ? "null" : FontSize.ToString())}, "); sb.Append($"{nameof(FontStyle)}: {(FontStyle == null ? "null" : FontStyle.ToString())}, "); sb.Append($"{nameof(Text)}: {Text}, "); sb.Append($"{nameof(ZOrder)}: {ZOrder}, "); sb.Append($"{nameof(DrawCrossLines)}: {DrawCrossLines}, "); sb.Append($"{nameof(MarkupSubType)}: {MarkupSubType}, "); sb.Append($"{nameof(Xd)}: {Xd}, "); sb.Append($"{nameof(Yd)}: {Yd}, "); sb.Append($"{nameof(WidthD)}: {WidthD}, "); sb.Append($"{nameof(HeightD)}: {HeightD}"); String retVal = sb.ToString(); return(retVal); }
/// <summary> /// Starts the new size rule. /// </summary> /// <param name="borderSize">Border size to be applied.</param> /// <returns>Next rule reference.</returns> public IFluentBorderWithAll WithSize(BorderSize borderSize) { rules ??= new(); var borderDefinition = new BorderDefinition { Side = BorderSide.All }; if (rules.TryGetValue(borderSize, out var rule)) { rule.Add(borderDefinition); } else { rules.Add(borderSize, new() { borderDefinition }); } currentBorderDefinition = borderDefinition; Dirty(); return(this); }
private string GetBorderSizeName(BorderSize borderSize) { if (borderSize == BorderSize.A0) { return("A0"); } if (borderSize == BorderSize.A1) { return("A1"); } if (borderSize == BorderSize.A2) { return("A2"); } if (borderSize == BorderSize.A3) { return("A3"); } if (borderSize == BorderSize.A4) { return("A4"); } return(""); }
public override Image Apply(Image img) { if (string.IsNullOrEmpty(Text)) { return(img); } using (Font textFont = TextFont) { if (textFont == null || textFont.Size < 1) { return(img); } NameParser parser = new NameParser(NameParserType.Text); if (img != null) { parser.ImageWidth = img.Width; parser.ImageHeight = img.Height; } string parsedText = parser.Parse(Text); Size textSize = Helpers.MeasureText(parsedText, textFont); Size watermarkSize = new Size(Padding.Left + textSize.Width + Padding.Right, Padding.Top + textSize.Height + Padding.Bottom); Point watermarkPosition = Helpers.GetPosition(Placement, Offset, img.Size, watermarkSize); Rectangle watermarkRectangle = new Rectangle(watermarkPosition, watermarkSize); if (AutoHide && !new Rectangle(0, 0, img.Width, img.Height).Contains(watermarkRectangle)) { return(img); } using (Graphics g = Graphics.FromImage(img)) { g.SmoothingMode = SmoothingMode.HighQuality; using (GraphicsPath gp = new GraphicsPath()) { gp.AddRoundedRectangleProper(watermarkRectangle, CornerRadius); if (DrawBackground) { Brush backgroundBrush = null; try { if (UseGradient) { if (UseCustomGradient && Gradient != null && Gradient.IsValid) { backgroundBrush = Gradient.GetGradientBrush(watermarkRectangle); } else { backgroundBrush = new LinearGradientBrush(watermarkRectangle, BackgroundColor, BackgroundColor2, GradientType); } } else { backgroundBrush = new SolidBrush(BackgroundColor); } g.FillPath(backgroundBrush, gp); } finally { if (backgroundBrush != null) { backgroundBrush.Dispose(); } } } if (DrawBorder) { int borderSize = BorderSize.Max(1); if (borderSize.IsEvenNumber()) { g.PixelOffsetMode = PixelOffsetMode.Half; } using (Pen borderPen = new Pen(BorderColor, borderSize)) { g.DrawPath(borderPen, gp); } g.PixelOffsetMode = PixelOffsetMode.Default; } } if (DrawTextShadow) { using (Brush textShadowBrush = new SolidBrush(TextShadowColor)) { g.DrawString(parsedText, textFont, textShadowBrush, watermarkRectangle.X + Padding.Left + TextShadowOffset.X, watermarkRectangle.Y + Padding.Top + TextShadowOffset.Y); } } using (Brush textBrush = new SolidBrush(TextColor)) { g.DrawString(parsedText, textFont, textBrush, watermarkRectangle.X + Padding.Left, watermarkRectangle.Y + Padding.Top); } } } return(img); }
protected override void CreateStyle(IStyleSheet StyleSheet, string RootCss) { IStyleSheet with_1 = StyleSheet; CustomStyle window = new CustomStyle(); window.Style[HtmlTextWriterStyle.BorderCollapse] = "collapse"; window.Style["border"] = "0"; window.Style["padding"] = "0"; window.Style["margin"] = "0"; with_1.CreateStyleRule(window, null, RootCss); //--- TITLE ---- CustomStyle title = new CustomStyle(); title.Style[HtmlTextWriterStyle.Height] = TitleBarSize.ToString(); title.Style["border"] = "0"; title.Style["padding"] = "0"; title.Style["margin"] = "0"; with_1.CreateStyleRule(title, null, RootCss + " tr.title"); //title left CustomStyle titleLeft = new CustomStyle(); titleLeft.Style[HtmlTextWriterStyle.Width] = BorderSize.ToString(); titleLeft.Style[HtmlTextWriterStyle.BackgroundImage] = "url(" + Page.ClientScript.GetWebResourceUrl(this.GetType(), Configuration.Resources.WindowTitleLeftGif) + ")"; titleLeft.Style["border"] = "0"; titleLeft.Style["padding"] = "0"; titleLeft.Style["margin"] = "0"; with_1.CreateStyleRule(titleLeft, null, RootCss + " tr.title td.left"); //title center CustomStyle titleCenter = new CustomStyle(); titleCenter.Style[HtmlTextWriterStyle.BackgroundImage] = "url(" + Page.ClientScript.GetWebResourceUrl(this.GetType(), Configuration.Resources.WindowTitleGif) + ")"; titleCenter.Style["border"] = "0"; titleCenter.Style["padding"] = "0"; titleCenter.Style["margin"] = "0"; with_1.CreateStyleRule(titleCenter, null, RootCss + " tr.title td.center"); //title right CustomStyle titleRight = new CustomStyle(); titleRight.Style[HtmlTextWriterStyle.Width] = BorderSize.ToString(); titleRight.Style[HtmlTextWriterStyle.BackgroundImage] = "url(" + Page.ClientScript.GetWebResourceUrl(this.GetType(), Configuration.Resources.WindowTitleRightGif) + ")"; titleRight.Style["border"] = "0"; titleRight.Style["padding"] = "0"; titleRight.Style["margin"] = "0"; with_1.CreateStyleRule(titleRight, null, RootCss + " tr.title td.right"); //title text with_1.CreateStyleRule(MyWindow.TitleStyle, null, RootCss + " tr.title td.center div.titleText"); //title close CustomStyle titleClose = new CustomStyle(); titleClose.Style[HtmlTextWriterStyle.Overflow] = "hidden"; titleClose.Style["float"] = "right"; titleClose.Style[HtmlTextWriterStyle.Width] = CloseButtonWidth.ToString(); titleClose.Style[HtmlTextWriterStyle.Height] = CloseButtonHeight.ToString(); titleClose.Style[HtmlTextWriterStyle.MarginTop] = "3px"; titleClose.Style[HtmlTextWriterStyle.MarginRight] = "2px"; titleClose.Style["border"] = "0"; titleClose.Style[HtmlTextWriterStyle.Cursor] = "pointer"; titleClose.Style[HtmlTextWriterStyle.BackgroundImage] = "url(" + Page.ClientScript.GetWebResourceUrl(this.GetType(), Configuration.Resources.WindowCloseGif) + ")"; with_1.CreateStyleRule(titleClose, null, RootCss + " tr.title td.center div.close"); CustomStyle titleCloseup = new CustomStyle(); titleCloseup.Style[HtmlTextWriterStyle.BackgroundImage] = "url(" + Page.ClientScript.GetWebResourceUrl(this.GetType(), Configuration.Resources.WindowCloseUpGif) + ")"; with_1.CreateStyleRule(titleCloseup, null, RootCss + " tr.title td.center div.close:hover"); //--- CONTENT ---- CustomStyle content = new CustomStyle(); content.Style["border"] = "0"; content.Style["padding"] = "0"; content.Style["margin"] = "0"; with_1.CreateStyleRule(content, null, RootCss + " tr.content"); //content left CustomStyle contentLeft = new CustomStyle(); contentLeft.Style[HtmlTextWriterStyle.Width] = BorderSize.ToString(); contentLeft.Style[HtmlTextWriterStyle.BackgroundImage] = "url(" + Page.ClientScript.GetWebResourceUrl(this.GetType(), Configuration.Resources.WindowLeftGif) + ")"; contentLeft.Style["border"] = "0"; contentLeft.Style["padding"] = "0"; contentLeft.Style["margin"] = "0"; with_1.CreateStyleRule(contentLeft, null, RootCss + " tr.content td.left"); //content center CustomStyle contentCenter = new CustomStyle(); int newHeight = 100; if (!MyWindow.Height.IsEmpty) { newHeight = (int)MyWindow.Height.Value; } //.Style(HtmlTextWriterStyle.Height) = CStr(newHeight - TitleBarSize.Value - BorderSize.Value) & "px" contentCenter.Style["border"] = "0"; contentCenter.Style["padding"] = "0"; contentCenter.Style["margin"] = "0"; with_1.CreateStyleRule(contentCenter, null, RootCss + " tr.content td.center"); if (!MyWindow.ContentStyle.IsEmpty) { with_1.CreateStyleRule(MyWindow.ContentStyle, null, RootCss + " tr.content td.center"); } //content center div CustomStyle contentCenterDiv = new CustomStyle(); contentCenterDiv.Style[HtmlTextWriterStyle.Overflow] = "auto"; contentCenterDiv.Style[HtmlTextWriterStyle.Height] = (newHeight - 50).ToString() + "px"; with_1.CreateStyleRule(contentCenterDiv, null, RootCss + " tr.content td.center div.content"); //content right CustomStyle contentRight = new CustomStyle(); contentRight.Style[HtmlTextWriterStyle.Width] = BorderSize.ToString(); contentRight.Style[HtmlTextWriterStyle.BackgroundImage] = "url(" + Page.ClientScript.GetWebResourceUrl(this.GetType(), Configuration.Resources.WindowRightGif) + ")"; contentRight.Style["border"] = "0"; contentRight.Style["padding"] = "0"; contentRight.Style["margin"] = "0"; with_1.CreateStyleRule(contentRight, null, RootCss + " tr.content td.right"); //--- FOOTER --- CustomStyle footer = new CustomStyle(); footer.Style[HtmlTextWriterStyle.Height] = BorderSize.ToString(); footer.Style["border"] = "0"; footer.Style["padding"] = "0"; footer.Style["margin"] = "0"; with_1.CreateStyleRule(footer, null, RootCss + " tr.footer"); //footer left CustomStyle footerLeft = new CustomStyle(); footerLeft.Style[HtmlTextWriterStyle.Width] = BorderSize.ToString(); footerLeft.Style[HtmlTextWriterStyle.BackgroundImage] = "url(" + Page.ClientScript.GetWebResourceUrl(this.GetType(), Configuration.Resources.WindowBottomLeftGif) + ")"; footerLeft.Style["border"] = "0"; footerLeft.Style["padding"] = "0"; footerLeft.Style["margin"] = "0"; with_1.CreateStyleRule(footerLeft, null, RootCss + " tr.footer td.left"); //footer center CustomStyle footerCenter = new CustomStyle(); footerCenter.Style[HtmlTextWriterStyle.BackgroundImage] = "url(" + Page.ClientScript.GetWebResourceUrl(this.GetType(), Configuration.Resources.WindowBottomGif) + ")"; footerCenter.Style["border"] = "0"; footerCenter.Style["padding"] = "0"; footerCenter.Style["margin"] = "0"; with_1.CreateStyleRule(footerCenter, null, RootCss + " tr.footer td.center"); //footer right CustomStyle footerRight = new CustomStyle(); footerRight.Style[HtmlTextWriterStyle.Width] = BorderSize.ToString(); footerRight.Style[HtmlTextWriterStyle.BackgroundImage] = "url(" + Page.ClientScript.GetWebResourceUrl(this.GetType(), Configuration.Resources.WindowBottomRightGif) + ")"; footerRight.Style["border"] = "0"; footerRight.Style["padding"] = "0"; footerRight.Style["margin"] = "0"; with_1.CreateStyleRule(footerRight, null, RootCss + " tr.footer td.right"); }
public static BorderSize SetRight(this BorderSize me, float value) => new BorderSize(me.Top, me.Bottom, me.Left, value);
public static BorderSize SetLeft(this BorderSize me, float value) => new BorderSize(me.Top, me.Bottom, value, me.Right);
public static BorderSize SetTop(this BorderSize me, float value) => new BorderSize(value, me.Bottom, me.Left, me.Right);
private bool Read(XmlNode pParent, BorderSize borderSize, BorderType borderType) { BorderConfig borderCofig = new BorderConfig(); borderCofig.m_BorderType = borderType; borderCofig.m_BorderSize = borderSize; borderCofig.m_BarcodeConfigInfo = new BarcodeConfigInfo(); borderCofig.m_QRCodeConfigInfo = new QRCodeConfigInfo(); borderCofig.m_SignConfigInfo = new SignConfigInfo(); borderCofig.m_CoSignConfigInfo = new CoSignConfigInfo(); borderCofig.m_StampConfigInfos = new List <StampConfigInfo>(); string borderSizeStr = GetBorderSizeName(borderSize); XmlNode size_xn = pParent.SelectSingleNode(borderSizeStr); XmlNodeList info_xns = size_xn.ChildNodes; foreach (XmlNode xn in info_xns) { XmlElement element = (XmlElement)xn; if (element.Name == "Barcode") { borderCofig.m_BarcodeConfigInfo.Height = Convert.ToDouble(element.GetAttribute("Height")); borderCofig.m_BarcodeConfigInfo.Angle = Convert.ToDouble(element.GetAttribute("Angle")); borderCofig.m_BarcodeConfigInfo.CorrectPosX = Convert.ToDouble(element.GetAttribute("CorrectPosX")); borderCofig.m_BarcodeConfigInfo.CorrectPosY = Convert.ToDouble(element.GetAttribute("CorrectPosY")); } if (element.Name == "QRcode") { borderCofig.m_QRCodeConfigInfo.Width = Convert.ToDouble(element.GetAttribute("ExtWidth")); borderCofig.m_QRCodeConfigInfo.Height = Convert.ToDouble(element.GetAttribute("ExtHeight")); borderCofig.m_QRCodeConfigInfo.Angle = Convert.ToDouble(element.GetAttribute("Angle")); borderCofig.m_QRCodeConfigInfo.CorrectPosX = Convert.ToDouble(element.GetAttribute("CorrectPosX")); borderCofig.m_QRCodeConfigInfo.CorrectPosY = Convert.ToDouble(element.GetAttribute("CorrectPosY")); } if (element.Name == "Sign") { borderCofig.m_SignConfigInfo.Width = Convert.ToDouble(element.GetAttribute("SignExtWidth")); borderCofig.m_SignConfigInfo.Height = Convert.ToDouble(element.GetAttribute("SignExtHeight")); borderCofig.m_SignConfigInfo.TextHeight = Convert.ToDouble(element.GetAttribute("Height")); borderCofig.m_SignConfigInfo.Angle = Convert.ToDouble(element.GetAttribute("Angle")); borderCofig.m_SignConfigInfo.CorrectPosX = Convert.ToDouble(element.GetAttribute("CorrectPosX")); borderCofig.m_SignConfigInfo.CorrectPosY = Convert.ToDouble(element.GetAttribute("CorrectPosY")); } if (element.Name == "CoSign") { borderCofig.m_CoSignConfigInfo.Width = Convert.ToDouble(element.GetAttribute("CoSignExtWidth")); borderCofig.m_CoSignConfigInfo.Height = Convert.ToDouble(element.GetAttribute("CoSignExtHeight")); borderCofig.m_CoSignConfigInfo.TextHeight = Convert.ToDouble(element.GetAttribute("Height")); borderCofig.m_CoSignConfigInfo.Angle = Convert.ToDouble(element.GetAttribute("Angle")); borderCofig.m_CoSignConfigInfo.CorrectPosX = Convert.ToDouble(element.GetAttribute("CorrectPosX")); borderCofig.m_CoSignConfigInfo.CorrectPosY = Convert.ToDouble(element.GetAttribute("CorrectPosY")); } if (element.Name == "Stamp") { StampConfigInfo stampInfo = new StampConfigInfo(); stampInfo.Width = Convert.ToDouble(element.GetAttribute("StampExtWidth")); stampInfo.Height = Convert.ToDouble(element.GetAttribute("StampExtHeight")); stampInfo.Angle = Convert.ToDouble(element.GetAttribute("Angle")); stampInfo.CorrectPosX = Convert.ToDouble(element.GetAttribute("CorrectPosX")); stampInfo.CorrectPosY = Convert.ToDouble(element.GetAttribute("CorrectPosY")); XmlNodeList nodes = xn.ChildNodes; foreach (XmlNode node in nodes) { element = (XmlElement)node; ChildeStampConfigInfo childStampInfo = new ChildeStampConfigInfo(); childStampInfo.Width = Convert.ToDouble(element.GetAttribute("StampExtWidth")); childStampInfo.Height = Convert.ToDouble(element.GetAttribute("StampExtHeight")); childStampInfo.Angle = Convert.ToDouble(element.GetAttribute("Angle")); childStampInfo.PointX = Convert.ToDouble(element.GetAttribute("RelativePosX")); childStampInfo.PointY = Convert.ToDouble(element.GetAttribute("RelativePosY")); stampInfo.ChildStampConfigInfos.Add(childStampInfo); } borderCofig.m_StampConfigInfos.Add(stampInfo); } } m_lst_BorderConfig.Add(borderCofig); return(true); }
public Table SetTableCellStyle(Table tbl, int x, int y, string sCellStyleAll) { if (x >= tbl.Rows.Count || x < 0) { return(tbl); } else { if (y >= tbl.Rows[x].Cells.Count || (y != -1 && y < 0)) { return(tbl); } } string[] aCellStyle;//由属性串分割成的属性数组 string sStyleName = ""; string sStyleValue = ""; aCellStyle = sCellStyleAll.Split(';'); for (int m = 0; m < aCellStyle.Length; m++) { if (aCellStyle[m].IndexOf(':') < 0) { continue; } //sStyleName = aCellStyle[m].Substring(0, aCellStyle[m].IndexOf(':')); //sStyleValue = aCellStyle[m].Substring(aCellStyle[m].IndexOf(':') + 1); string[] aCellStyleOne = aCellStyle[m].Split(':'); sStyleName = aCellStyleOne[0]; sStyleValue = aCellStyleOne[1]; BorderStyle BorderStyle_Tcbs = BorderStyle.Tcbs_single; //BorderStyle BorderStyle_Tcbs = BorderStyle.Tcbs_dotted; BorderSize BorderStyle_Size = BorderSize.one; int BorderStyle_Space = 0; System.Drawing.Color BorderStyle_Color = System.Drawing.Color.Black; TableCellBorderType tblCellBorderType = TableCellBorderType.Left; if (aCellStyleOne.Length > 2) { for (int p = 2; p < aCellStyleOne.Length; p++) { string sBorderProperty = aCellStyleOne[p].Substring(0, aCellStyleOne[p].IndexOf('_')); string sBorderValue = aCellStyleOne[p].Substring(aCellStyleOne[p].IndexOf('_') + 1); if (sBorderProperty.ToUpper() == "BORDERSTYLE")//调边线样式 { if (sBorderValue.ToUpper() == "DOTTED") { BorderStyle_Tcbs = BorderStyle.Tcbs_dotted; } else if (sBorderValue.ToUpper() == "NONE") { BorderStyle_Tcbs = BorderStyle.Tcbs_none; } else if (sBorderValue.ToUpper() == "SINGLE") { BorderStyle_Tcbs = BorderStyle.Tcbs_single; } } else if (sBorderProperty.ToUpper() == "BORDERSIZE")//调边线粗细 { } else if (sBorderProperty.ToUpper() == "BORDERCOLOR")//调边线颜色 { if (sBorderValue.ToUpper() == "RED") { BorderStyle_Color = System.Drawing.Color.Red; } else if (sBorderValue.ToUpper() == "WHITE") { BorderStyle_Color = System.Drawing.Color.White; } } } } if (sStyleName.ToUpper() == "BORDER") { if (sStyleValue.ToUpper() == "LEFT") { tblCellBorderType = TableCellBorderType.Left; } else if (sStyleValue.ToUpper() == "TOP") { tblCellBorderType = TableCellBorderType.Top; } else if (sStyleValue.ToUpper() == "RIGHT") { tblCellBorderType = TableCellBorderType.Right; } else if (sStyleValue.ToUpper() == "BOTTOM") { tblCellBorderType = TableCellBorderType.Bottom; } if (y == -1) { for (int z = 0; z < tbl.Rows[x].Cells.Count; z++) { tbl.Rows[x].Cells[z].SetBorder(tblCellBorderType, new Border(BorderStyle_Tcbs, BorderStyle_Size, BorderStyle_Space, BorderStyle_Color)); } } else { tbl.Rows[x].Cells[y].SetBorder(tblCellBorderType, new Border(BorderStyle_Tcbs, BorderStyle_Size, BorderStyle_Space, BorderStyle_Color)); } } if (sStyleName.ToUpper() == "PARAGRAPHALIGN") { if (sStyleValue.ToUpper() == "LEFT") { if (y == -1) { for (int z = 0; z < tbl.Rows[x].Cells.Count; z++) { tbl.Rows[x].Cells[z].Paragraphs[0].Alignment = Alignment.left; } } else { tbl.Rows[x].Cells[y].Paragraphs[0].Alignment = Alignment.left; } } else if (sStyleValue.ToUpper() == "RIGHT") { if (y == -1) { for (int z = 0; z < tbl.Rows[x].Cells.Count; z++) { tbl.Rows[x].Cells[z].Paragraphs[0].Alignment = Alignment.right; } } else { tbl.Rows[x].Cells[y].Paragraphs[0].Alignment = Alignment.right; } } else if (sStyleValue.ToUpper() == "CENTER") { if (y == -1) { for (int z = 0; z < tbl.Rows[x].Cells.Count; z++) { tbl.Rows[x].Cells[z].Paragraphs[0].Alignment = Alignment.center; } } else { tbl.Rows[x].Cells[y].Paragraphs[0].Alignment = Alignment.center; } } else if (sStyleValue.ToUpper() == "VTOP") { if (y == -1) { for (int z = 0; z < tbl.Rows[x].Cells.Count; z++) { tbl.Rows[x].Cells[z].VerticalAlignment = VerticalAlignment.Top; } } else { tbl.Rows[x].Cells[y].VerticalAlignment = VerticalAlignment.Top; } } else if (sStyleValue.ToUpper() == "VCENTER") { if (y == -1) { for (int z = 0; z < tbl.Rows[x].Cells.Count; z++) { tbl.Rows[x].Cells[z].VerticalAlignment = VerticalAlignment.Center; } } else { tbl.Rows[x].Cells[y].VerticalAlignment = VerticalAlignment.Center; } } else if (sStyleValue.ToUpper() == "VBOTTOM") { if (y == -1) { for (int z = 0; z < tbl.Rows[x].Cells.Count; z++) { tbl.Rows[x].Cells[z].VerticalAlignment = VerticalAlignment.Bottom; } } else { tbl.Rows[x].Cells[y].VerticalAlignment = VerticalAlignment.Bottom; } } else if (sStyleValue.ToUpper() == "BOTH") { if (y == -1) { for (int z = 0; z < tbl.Rows[x].Cells.Count; z++) { tbl.Rows[x].Cells[z].Paragraphs[0].Alignment = Alignment.both; } } else { tbl.Rows[x].Cells[y].Paragraphs[0].Alignment = Alignment.both; } } } } return(tbl); }