示例#1
0
        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;
        }
示例#2
0
        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();
        }
示例#3
0
        /// <summary>
        /// OK事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void okButton_Click(object sender, EventArgs e)
        {
            XhtmlSection section = new XhtmlSection();

            XhtmlTags.A aTag = section.CreateXhtmlA();
            if (mainTabControl.SelectedIndex == 0)
            {
                string strUrl = "[url:]" + linkTitleTextBox.Text;
                if (!String.IsNullOrEmpty(bookmarkComboBox.Text.Trim()))
                {
                    strUrl += "#" + bookmarkComboBox.Text.Trim();
                }
                aTag.Href      = strUrl;
                aTag.LinkText  = linkTextTextBox.Text;
                aTag.Title     = linkTitleTextBox.Text;
                aTag.Target    = targetComboBox.Text;
                aTag.TabIndex  = tabKeyIndexTextBox.Text;
                aTag.Accesskey = accesskeyTextBox.Text;

                if (_aElement == null)
                {
                    return;
                }

                XmlElement ele = (XmlElement)aTag.ToXmlNode();
                //将原来属性删除掉,重新赋值
                _aElement.Attributes.RemoveAll();
                foreach (XmlAttribute att in ele.Attributes)
                {
                    _aElement.SetAttribute(att.Name, att.Value);
                }
            }
            else if (mainTabControl.SelectedIndex == 1)
            {
                aTag.Href = "mailto:" + emailTextTextBox.Text;

                XmlElement ele = (XmlElement)aTag.ToXmlNode();
                //将原来属性删除掉,重新赋值
                _aElement.Attributes.RemoveAll();
                if (ele.HasAttribute("href"))
                {
                    _aElement.SetAttribute("href", ele.Attributes["href"].Value);
                    XmlDocument xmlDoc = new XmlDocument();
                    //XmlText xmlText = _aElement.OwnerDocument.CreateTextNode(emailSubjectTextBox.Text);
                    XmlText xmlText = xmlDoc.CreateTextNode(emailSubjectTextBox.Text);
                    _aElement.AppendChild(xmlText);
                }
            }
        }
示例#4
0
 private void NewMethod()
 {
     _aTag = _section.CreateXhtmlA();
     _section.AppendChild(_aTag);
 }