public Block(float lf, float tp, float rh, float bm, RssBodyType type = RssBodyType.Title) { this.right = rh; this.top = tp; this.left = lf; this.bottom = bm; this.type = type; this.width = this.right - this.left; this.height = this.bottom - this.top; }
public Paragraph(List <Character> list, RssBodyType type) { this.list = list; this.type = type; this.font = list[0].font; }
//从Rss中取得格式化字符段落 private List <Paragraph> GetCharacter(string text, System.Drawing.Font font, System.Drawing.Color color, RssBodyType type) { List <Paragraph> paragraphs = new List <Paragraph>(); List <Character> characters = new List <Character>(); if (string.IsNullOrEmpty(text)) { return(null); } char[] cr = text.ToCharArray(); StringBuilder strbuilder = new StringBuilder(); foreach (char c in cr) { //拼接成英文单词,防止单词越行 if ((c >= 'a' && c <= 'z') || ((c >= 'A' && c <= 'Z'))) { strbuilder.Append(c); } else { if (strbuilder.Length != 0) { characters.Add(new Character(strbuilder.ToString(), font, color)); strbuilder = new StringBuilder(); } characters.Add(new Character(c, font, color)); } } if (strbuilder.Length != 0) { characters.Add(new Character(strbuilder.ToString(), font, color)); } Paragraph paragraph = new Paragraph(characters, type); paragraph.font = font; paragraphs.Add(paragraph); return(paragraphs); }