Example #1
0
        /// <summary>
        /// 设置CSS样式
        /// </summary>
        /// <param name="style">样式</param>
        /// <param name="control">控件</param>
        public virtual void setStyle(String style, FCProperty control)
        {
            bool   isStr = false;
            String str   = "";

            foreach (char ch in style)
            {
                if (ch == '\'')
                {
                    isStr = !isStr;
                }
                if (!isStr)
                {
                    if (ch == ';')
                    {
                        int    idx    = str.IndexOf(':');
                        String pName  = str.Substring(0, idx);
                        String pValue = str.Substring(idx + 1);
                        control.setProperty(pName.ToLower(), pValue);
                        str = "";
                        continue;
                    }
                    else if (ch == ' ')
                    {
                        continue;
                    }
                }
                str += ch.ToString();
            }
        }
Example #2
0
        /// <summary>
        /// 后设置属性
        /// </summary>
        /// <param name="node">XML节点</param>
        /// <param name="control">属性对象</param>
        public virtual void setAttributesAfter(XmlNode node, FCProperty control)
        {
            HashMap <String, String> attributes = getAttributes(node);

            //读取属性
            foreach (String name in attributes.Keys)
            {
                if (isAfterSetingAttribute(name))
                {
                    control.setProperty(name, attributes.get(name));
                }
                else if (name == "class")
                {
                    if (m_styles.containsKey(attributes.get(name)))
                    {
                        setStyle(m_styles.get(attributes.get(name)), control);
                    }
                }
                else if (name == "style")
                {
                    setStyle(attributes.get(name), control);
                }
            }
            attributes.clear();
        }
Example #3
0
        /// <summary>
        /// 前设置属性
        /// </summary>
        /// <param name="node">XML节点</param>
        /// <param name="control">属性对象</param>
        public virtual void setAttributesBefore(XmlNode node, FCProperty control)
        {
            HashMap <String, String> attributes = getAttributes(node);

            //读取属性
            foreach (String name in attributes.Keys)
            {
                if (!isAfterSetingAttribute(name))
                {
                    control.setProperty(name, attributes.get(name));
                }
            }
            attributes.clear();
        }