bool CDocMgr::ReadXmlFile(string& szFileName) { //读取Xml文件,并遍历 XMLRdr xml(szFileName); //string str(m_DocLst.GetBuffer(1)); //m_DocLst.ReleaseBuffer(); //xml.ProcessString(str); XMLNode *root = xml.GetRootNode(); if(root == NULL) return false; long cnt = root->GetChildNodeCnt(); for(int i=0;i<cnt;i++) { XMLNode *chdNode = root->GetNextChild(); if(chdNode == NULL) return false; string sType = chdNode->GetElementValue("Type"); string sAlias = chdNode->GetElementValue("Alias"); string sTitle = chdNode->GetElementValue("Title"); string sEncode = chdNode->GetElementValue("Encode"); string sPage = chdNode->GetElementValue("iPage"); string sSize = chdNode->GetElementValue("Size"); //string sUpdated = chdNode->GetElementValue("Updated"); string sEdition = chdNode->GetElementValue("Edition"); string sURL = chdNode->GetElementValue("URL"); string sfullURL = chdNode->GetElementValue("fullURL"); string sProcessType = chdNode->GetElementValue("ProcessType"); string sIsZhengWen = chdNode->GetElementValue("IsZhengWen"); //string sMossSiteURL = chdNode->GetElementValue("MossSiteURL"); string sFolderName = chdNode->GetElementValue("FolderName"); string sFileName = chdNode->GetElementValue("FileName"); string sIsCopy = chdNode->GetElementValue("IsCopy"); string sWorkItemID = chdNode->GetElementValue("WorkItemID"); CString csType(sType.c_str()); CString csAlias(sAlias.c_str()); CString csTitle(sTitle.c_str()); CString csEncode(sEncode.c_str()); CString csPage(sPage.c_str()); CString csSize(sSize.c_str()); //CString csUpdated(sUpdated.c_str()); CString csEdition(sEdition.c_str()); CString csURL(sURL.c_str()); CString csfullURL(sfullURL.c_str()); CString csProcessType(sProcessType.c_str()); CString csIsZhengWen(sIsZhengWen.c_str()); //CString csMossSiteURL(sMossSiteURL.c_str()); CString csFolderName(sFolderName.c_str()); CString csFileName(sFileName.c_str()); CString csIsCopy(sIsCopy.c_str()); CString csWorkItemID(sWorkItemID.c_str()); InsertDocItem(csAlias, csEncode, csPage, csSize, csType, csTitle, csEdition, csURL, csfullURL,csProcessType, csIsZhengWen, csFolderName, csFileName, csIsCopy, csWorkItemID); } return true; }
void CCalendarCtrl::DrawHeader(CDC* pDC) { CRect rc; GetClientRect(&rc); rc.bottom = rc.top + CALENDAR_HEADER_HEIGHT; CRect rcLine(rc); rcLine.top = rcLine.bottom-1; for(int i=0; i<CALENDAR_HEADER_HEIGHT; i++) { pDC->FillSolidRect(rcLine, GetFadedBlue(i*4)); rcLine.bottom--; rcLine.top = rcLine.bottom-1; } CFont* pOldFont = pDC->SelectObject(&m_DefaultFont); int nWidth = rc.Width()/CALENDAR_COLUMNS; bool bShort = false; for(i=0; i<CALENDAR_COLUMNS; i++) { CRect txtRect(i*nWidth, 0, (i+1)*nWidth, CALENDAR_HEADER_HEIGHT); CString csTitle(m_dayCells[0][i].date.Format(_T("%A"))); CSize TitleSize(pDC->GetTextExtent(csTitle)); if(TitleSize.cx > txtRect.Width()){ bShort = true; break; } } for(i=0 ; i<CALENDAR_COLUMNS; i++) { CString csTitle(m_dayCells[0][i].date.Format(_T("%A"))); CRect txtRect(i*nWidth, 0, (i+1)*nWidth, CALENDAR_HEADER_HEIGHT); if(bShort) csTitle = csTitle.Left(3); pDC->DrawText(csTitle, txtRect, DT_CENTER|DT_VCENTER); } pDC->SelectObject(pOldFont); }