后台设置控件宽高的问题

Oct 12, 2010 at 3:16 AM

    我用动态修改控件的宽度,页面运行不通过,代码如下:(其中windows1是ext:Window控件的ID)。

                Unit m_UnitwinWidth = new Unit("240px");
                Unit m_UnitwinwinHeight = new Unit("240px");
                this.Window1.Width = m_UnitwinWidth;
                this.Window1.Height = m_UnitwinwinHeight;

   最后通过修改ControlBase控件的ConvertPropertiesToXState把宽高属性删除,页面运行正常,修改如下:

        /// <summary>
        /// Get X_STATE object from property name list.
        /// </summary>
        /// <param name="propertyList"></param>
        /// <returns></returns>
        private JSONObject ConvertPropertiesToXState(List<string> propertyList)
        {
            JSONObject jo = new JSONObject();
            foreach (string property in propertyList)
            {
                if (!("width"==property.ToLower() || "height"== property.ToLower()))
                {
                    object propertyValue = GetPropertyJSONValue(property);
                    jo.put(property, propertyValue == null ? "" : propertyValue);
                }
            }
            return jo;
        }

      高手帮看一下是什么问题,怎样修改才是?