// 加载XML节点,解析节点中的属性信息设置到当前控件的属性中 BOOL CDuiObject::Load(DuiXmlNode pXmlElem, BOOL bLoadSubControl) { // pos属性需要特殊处理,放在最后进行设置,否则有些属性会受到影响,不能正确的初始化 CString strPosValue = _T(""); for (DuiXmlAttribute pAttrib = pXmlElem.first_attribute(); pAttrib; pAttrib = pAttrib.next_attribute()) { CString strName = pAttrib.name(); if(strName == _T("pos")) { strPosValue = pAttrib.value(); }else { SetAttribute(pAttrib.name(), pAttrib.value(), TRUE); } } if(!strPosValue.IsEmpty()) { SetAttribute(_T("pos"), strPosValue, TRUE); } // 初始化 OnInit(); return TRUE; }