Пример #1
0
 /// <summary>
 /// 加载对象数据
 /// </summary>
 /// <param name="myReader"></param>
 /// <returns></returns>
 internal override bool InnerRead(HTMLTextReader myReader)
 {
     myItems.Clear();
     strText = myReader.ReadToEndTag(this.TagName);
     if (strText != null)
     {
         strText = strText.Replace("<!--", "");
         strText = strText.Replace("-->", "");
         int index  = 0;
         int index2 = strText.IndexOf("{");
         while (index2 >= 0)
         {
             int index3 = strText.IndexOf("}", index2);
             if (index3 > index2)
             {
                 string            strName  = strText.Substring(index, index2 - index);
                 string            strValue = strText.Substring(index2 + 1, index3 - index2 - 1);
                 HTMLNameStyleItem NewItem  = new HTMLNameStyleItem();
                 NewItem.Name      = strName.Trim();
                 NewItem.CSSString = strValue;
                 myItems.Add(NewItem);
             }
             index  = index3 + 1;
             index2 = strText.IndexOf("{", index);
         }
     }
     //myReader.MoveAfter('>');
     return(true);
 }
Пример #2
0
        /// <summary>
        /// 删除指定名称的样式对象
        /// </summary>
        /// <param name="name">样式名称</param>
        public void Remove(string name)
        {
            HTMLNameStyleItem item = this[name];

            if (item != null)
            {
                myItems.Remove(item);
            }
        }
Пример #3
0
 /// <summary>
 /// 删除指定的样式对象
 /// </summary>
 /// <param name="item">样式对象</param>
 public void Remove(HTMLNameStyleItem item)
 {
     myItems.Remove(item);
 }
Пример #4
0
 /// <summary>
 /// 添加样式对象
 /// </summary>
 /// <param name="item"></param>
 public void Add(HTMLNameStyleItem item)
 {
     myItems.Add(item);
 }