protected override void TagCreator() { XhtmlElement tag = null; if (this.HasLinkForPart)///当Part本身有连接时的处理 { tag = this.ParentXhtmlElement.OwnerPage.CreateXhtmlA(); XhtmlTags.A tagA = (XhtmlTags.A)tag; tagA.Builder("", "", Xhtml.Target._blank, 0, 'a'); this.ParentXhtmlElement.AppendChild(tag); } if (tag == null)///当为Null时,即为该Part没有设置链接 { tag = this.ParentXhtmlElement; } switch (this.SnipPartType) { case SnipPartType.Static: ///静态Part的生成,比较简单 case SnipPartType.Navigation: ///导航Part的生成实际上与静态Part没有区别 #region 针对静态Part的值生成部份Html代码 { if (!string.IsNullOrEmpty(this.CDataValue)) { StringBuilder sb = new StringBuilder(); sb.Append(TempCDataTag.CDataTag).Append(this.CDataValue).Append(TempCDataTag.CDataTag); XhtmlElement htmlele = tag.OwnerPage.CreateXhtmlCData(sb.ToString()); tag.AppendChild(htmlele); } break; } #endregion case SnipPartType.List: base.TagCreator(); break; case SnipPartType.ListBox: base.TagCreator(); break; case SnipPartType.Box: base.TagCreator(); break; case SnipPartType.Path: base.TagCreator(); break; case SnipPartType.Attribute: ///定制特性的SnipPart { this.AttributeTagCreator(tag); break; } case SnipPartType.None: default: break; }//switch this.XhtmlElement = tag; }
private void 快速测试F5ToolStripMenuItem_Click(object sender, EventArgs e) { XhtmlSection sec = new XhtmlSection(); XhtmlTags.Img img = sec.CreateXhtmlImg(); img.Builder(new CssSection("css"), "alt", "hspace", "src", Xhtml.Align.bottom, "vspace", "1", "name"); this.codeTextBox.Text = img.ToString(); XhtmlTags.A a = sec.CreateXhtmlA(); a.Builder("a", "title", Xhtml.Target._parent, 1, 't'); this.outXmlTextBox.Text = a.ToString(); }