void CMainDlg::OnBtnClick_Project_File_Add() { CNewFileDlg dlg(this); if(!m_strPrjPath.IsEmpty() && IDOK==dlg.DoModal()) { xml_document xmlDoc; if(!xmlDoc.load_file(m_strPrjIndex)) return; xml_node xmlRoot = xmlDoc.child(L"resource"); if(!xmlRoot) { return; } xml_node xmlType=xmlRoot.child(S_CT2W(dlg.m_strResType)); xml_node xmlNode=xmlType.child(L"file"); SStringW strName = S_CT2W(dlg.m_strResName); while(xmlNode) { if(xmlNode.attribute(L"name").value() == strName) { break; } xmlNode = xmlNode.next_sibling(L"file"); } if(xmlNode) {//检查type,name重复 SMessageBox(GetActiveWindow(),_T("指定的资源名重复"),_T("错误"),MB_OK|MB_ICONSTOP); return; } BuildFilePath(m_strPrjPath,dlg.m_strResPath,FALSE); CopyFile(dlg.m_strSrcFile,m_strPrjPath+_T("\\")+dlg.m_strResPath,FALSE); //改写XML文件 if(!xmlType) { xmlType = xmlRoot.append_child(S_CT2W(dlg.m_strResType)); } xmlNode = xmlType.append_child(L"file"); xmlNode.append_attribute(L"name").set_value(S_CT2W(dlg.m_strResName)); xmlNode.append_attribute(L"path").set_value(S_CT2W(dlg.m_strResPath)); FILE *f=_tfopen(m_strPrjIndex,_T("wb")); if(f) { xml_writer_file xmlfile(f); xmlDoc.print(xmlfile); fclose(f); OpenProject(m_strPrjIndex); } } }
BOOL SGifPlayer::_PlayFile( LPCTSTR pszFileName, BOOL bGif ) { SStringW key=S_CT2W(pszFileName); SSkinPool *pBuiltinSkinPool = SSkinPoolMgr::getSingletonPtr()->GetBuiltinSkinPool(); ISkinObj *pSkin=pBuiltinSkinPool->GetSkin(key); if(pSkin) { if(!pSkin->IsClass(SSkinAni::GetClassName())) return FALSE; m_aniSkin=static_cast<SSkinAni*>(pSkin); }else { SSkinAni *pGifSkin = (SSkinAni*)SApplication::getSingleton().CreateSkinByName(bGif?SSkinGif::GetClassName():SSkinAPNG::GetClassName()); if(!pGifSkin) return FALSE; if(0==pGifSkin->LoadFromFile(pszFileName)) { pGifSkin->Release(); return FALSE; } pBuiltinSkinPool->AddKeyObject(key,pGifSkin);//将创建的skin交给skinpool管理 m_aniSkin = pGifSkin; } if(m_layout.IsFitContent()) { GetParent()->UpdateChildrenPosition(); } if(IsVisible(TRUE)) { GetContainer()->RegisterTimelineHandler(this); } return TRUE; }
BOOL SImagePlayer::_PlayFile( LPCTSTR pszFileName, BOOL bGif ) { SStringW key=S_CT2W(pszFileName); SSkinPool *pBuiltinSkinPool = SSkinPoolMgr::getSingletonPtr()->GetBuiltinSkinPool(); ISkinObj *pSkin=pBuiltinSkinPool->GetSkin(key); if(pSkin) { if(!pSkin->IsClass(SSkinAni::GetClassName())) return FALSE; m_aniSkin=static_cast<SSkinAni*>(pSkin); }else { SSkinAni *pGifSkin = (SSkinAni*)SApplication::getSingleton().CreateSkinByName(SSkinMutiFrameImg::GetClassName()); if(!pGifSkin) return FALSE; if(0==pGifSkin->LoadFromFile(pszFileName)) { pGifSkin->Release(); return FALSE; } pBuiltinSkinPool->AddKeyObject(key,pGifSkin);//将创建的skin交给skinpool管理 m_aniSkin = pGifSkin; } if(m_layout.IsFitContent()) { GetParent()->UpdateChildrenPosition(); } OnShowWindow(TRUE, NormalShow); return TRUE; }
void CFolderHander::OnFileDropdown( HDROP hDrop ) { TCHAR filename[MAX_PATH]; if(DragQueryFile(hDrop, 0, filename, MAX_PATH)!=0) { if(GetFileAttributes(filename) & FILE_ATTRIBUTE_DIRECTORY) { InitDir(S_CT2W(filename)); } } }
int SSkinGif::LoadFromFile( LPCTSTR pszFileName ) { Bitmap *pImg = Bitmap::FromFile(S_CT2W(pszFileName)); if(!pImg) return 0; if(pImg->GetLastStatus() != Gdiplus::Ok) { delete pImg; return 0; } LoadFromGdipImage(pImg); delete pImg; return m_nFrames; }
DWORD CCodeLineCounterHandler::EnumFileInfo(const CODECFGMAP &cfg, const SStringW & strPath, HSTREEITEM hItem,SList<FILEINFO> & lstFileInfo , int &nDirs) { DWORD fileSizeDir = 0; //枚举当前目录下的文件 WIN32_FIND_DATAW fd; SStringW strFind = strPath + L"\\*.*"; HANDLE hFind = FindFirstFileW(strFind,&fd); if(hFind != INVALID_HANDLE_VALUE) { while(FindNextFileW(hFind,&fd)) { if(!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { LPCWSTR pszExt = wcsrchr(fd.cFileName,L'.'); if(!pszExt) continue; pszExt ++; const CODECFGMAP::CPair * pPair = cfg.Lookup(pszExt); if(!pPair) continue; FILEINFO fi; fi.strFileName = strPath + L"\\" + fd.cFileName; fi.dwSize = fd.nFileSizeLow; fileSizeDir += fi.dwSize; fi.cfg = pPair->m_value; lstFileInfo.AddTail(fi); } } FindClose(hFind); } //查找选中的子目录 HSTREEITEM hChild = m_pDirTree->GetChildItem(hItem); while(hChild) { if(m_pDirTree->GetCheckState(hChild)) { SStringT strDirName; m_pDirTree->GetItemText(hChild,strDirName); SStringW strPath2 = strPath + L"\\" + S_CT2W(strDirName); fileSizeDir += EnumFileInfo(cfg,strPath2,hChild,lstFileInfo,nDirs); nDirs ++; } hChild = m_pDirTree->GetNextSiblingItem(hChild); } return fileSizeDir; }
BOOL SMenu::InsertMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem,LPCTSTR strText, int iIcon) { nFlags|=MF_OWNERDRAW; if(nFlags&MF_SEPARATOR) { return ::InsertMenu(m_hMenu,nPosition,nFlags,(UINT_PTR)0,(LPCTSTR)NULL); } SMenuItemData *pMenuData=new SMenuItemData; pMenuData->hMenu=m_hMenu; pMenuData->itemInfo.iIcon=iIcon; InitMenuItemData(pMenuData->itemInfo,S_CT2W(strText)); if(nFlags&MF_POPUP) { //插入子菜单, SMenu *pSubMenu=(SMenu*)(LPVOID)nIDNewItem; SASSERT(pSubMenu->m_pParent==NULL); pMenuData->nID=(UINT_PTR)pSubMenu->m_hMenu; } else { pMenuData->nID=nIDNewItem; } if(!::InsertMenu(m_hMenu,nPosition,nFlags,pMenuData->nID,(LPCTSTR)pMenuData)) { delete pMenuData; return FALSE; } SMenu *pRootMenu=this; while(pRootMenu->m_pParent) pRootMenu=pRootMenu->m_pParent; //将分配的内存放到根菜单的内存节点列表中 pRootMenu->m_arrDmmi.Add(pMenuData); if(nFlags&MF_POPUP) { //对子菜单还需要做数据迁移处理 SMenu *pSubMenu=(SMenu*)(LPVOID)nIDNewItem; for(UINT i=0; i<pSubMenu->m_arrDmmi.GetCount(); i++) pRootMenu->m_arrDmmi.Add(pSubMenu->m_arrDmmi[i]); pSubMenu->m_arrDmmi.RemoveAll(); pSubMenu->m_pParent=this; } return TRUE; }
void SMaskEdit::SetMaskState() { ASSERT(m_bUseMask); SStringT strWindowText = GetWindowText(); CorrectWindowText(); GetContainer()->SwndShowCaret(FALSE); if (strWindowText != m_strWindowText) { SetWindowText(S_CT2W(m_strWindowText)); m_bModified = TRUE; } SetSel(MAKELONG(m_nStartChar, m_nEndChar), FALSE); GetContainer()->SwndShowCaret(TRUE); }
int STabCtrl::GetPageIndex(LPCTSTR pszName,BOOL bTitle) { if(bTitle) { for(UINT i=0;i<m_lstPages.GetCount();i++) { if(_tcscmp(m_lstPages[i]->GetTitle(),pszName)==0) return i; } }else { SStringW strName = S_CT2W(pszName); for(UINT i=0;i<m_lstPages.GetCount();i++) { if(m_lstPages[i]->GetName()==strName) return i; } } return -1; }
BOOL SMaskEdit::SetEditMask(LPCTSTR lpszMask, LPCTSTR lpszLiteral, LPCTSTR lpszDefault) { ASSERT(lpszMask); ASSERT(lpszLiteral); // initialize the mask for the control. m_strMask = lpszMask; m_strLiteral = lpszLiteral; ASSERT(m_strMask.GetLength() == m_strLiteral.GetLength()); if (m_strMask.GetLength() != m_strLiteral.GetLength()) return FALSE; if (lpszDefault == NULL) { m_strWindowText = m_strDefault = lpszLiteral; } else { m_strWindowText = m_strDefault = lpszDefault; if (m_strDefault.GetLength() != m_strLiteral.GetLength()) { SetMaskedText(m_strDefault, 0, FALSE); m_strDefault = m_strWindowText; } } ASSERT(m_strWindowText.GetLength() == m_strLiteral.GetLength()); // set the window text for the control. m_bModified = FALSE; SetWindowText(S_CT2W(m_strWindowText)); return TRUE; }
void SDateEdit::SetDateTime(LPCTSTR strDate) { m_strWindowText = m_strDefault = strDate; SetWindowText(S_CT2W(strDate)); }
void CCodeLineCounterHandler::OnBtnGo() { if(m_strDir.IsEmpty()) { SMessageBox(m_pPageRoot->GetContainer()->GetHostHwnd(),_T("没有指定扫描目录"),_T("错误"),MB_OK|MB_ICONSTOP); return; } SStringT strTypes = m_pPageRoot->FindChildByName(L"edit_filetypes")->GetWindowText(); SStringWList lstTypes; SplitString(S_CT2W(strTypes),L';',lstTypes); CODECFGMAP cfg; for(UINT i=0;i<lstTypes.GetCount();i++) { CODECFGMAP::CPair *pPair = m_mapCodeCfg.Lookup(lstTypes[i]); if(!pPair) continue; cfg[lstTypes[i]] = pPair->m_value; } if(cfg.IsEmpty()) { SMessageBox(m_pPageRoot->GetContainer()->GetHostHwnd(),_T("没有指定文件类型或者类型无效"),_T("错误"),MB_OK|MB_ICONSTOP); return; } //获得文件列表,计每个目标文件的文件大小 HSTREEITEM hRoot = m_pDirTree->GetRootItem(); SList<FILEINFO> lstFileInfo; int nDirs = 1; DWORD szAll = EnumFileInfo(cfg,m_strDir,hRoot,lstFileInfo,nDirs); if(lstFileInfo.GetCount() == 0) { SMessageBox(m_pPageRoot->GetContainer()->GetHostHwnd(),_T("指定的目录下没有找到满足条件的文件类型"),_T("提示"),MB_OK|MB_ICONINFORMATION); return; } //SWindow *pPageResult = m_pPageRoot->FindChildByName(L"page_dir"); SSplitWnd_Row *pSplitTree = m_pPageRoot->FindChildByName2<SSplitWnd_Row>(L"split_tree"); pSplitTree->ShowPane(1); SProgress *pProgBar = pSplitTree->FindChildByName2<SProgress>(L"prog_run"); pProgBar->SetRange(0,szAll); pProgBar->SetValue(0); CLineInfo lineInfoAll; SMap<SStringW,CLineInfo> mapLineInfo; for(UINT i=0;i<lstTypes.GetCount();i++) { mapLineInfo[lstTypes[i]] = CLineInfo(); } //统计代码行 DWORD dwProg = 0; SPOSITION pos = lstFileInfo.GetHeadPosition(); while(pos) { FILEINFO fi = lstFileInfo.GetNext(pos); CLineInfo lineInfo; CountCodeLines(S_CW2T(fi.strFileName),fi.cfg,lineInfo.nCodeLines,lineInfo.nRemarkLines,lineInfo.nBlankLines); lineInfoAll += lineInfo; mapLineInfo[fi.cfg.strExt] += lineInfo; dwProg += fi.dwSize; pProgBar->SetValue(dwProg); pProgBar->UpdateWindow(); } pSplitTree->HidePane(1); STabCtrl *pTab = m_pPageRoot->FindChildByName2<STabCtrl>(L"tab_codeline"); pTab->SetCurSel(1); SWindow *pWndRes = pTab->GetPage(_T("page_result"),FALSE); pWndRes->FindChildByName(L"txt_folders")->SetWindowText(SStringT().Format(_T("%d"),nDirs)); pWndRes->FindChildByName(L"txt_files")->SetWindowText(SStringT().Format(_T("%d"),lstFileInfo.GetCount())); pWndRes->FindChildByName(L"txt_codelines")->SetWindowText(SStringT().Format(_T("%d"),lineInfoAll.nCodeLines)); pWndRes->FindChildByName(L"txt_blanklines")->SetWindowText(SStringT().Format(_T("%d"),lineInfoAll.nBlankLines)); pWndRes->FindChildByName(L"txt_remarklines")->SetWindowText(SStringT().Format(_T("%d"),lineInfoAll.nRemarkLines)); SListCtrl *plstReport = pWndRes->FindChildByName2<SListCtrl>(L"lst_linecounter_report"); plstReport->DeleteAllItems(); for(UINT i=0;i<lstTypes.GetCount();i++) { CCodeConfig codeCfg = cfg[lstTypes[i]]; CLineInfo lineInfo = mapLineInfo[lstTypes[i]]; plstReport->InsertItem(i,S_CW2T(codeCfg.strType)); plstReport->SetSubItemText(i,1,S_CW2T(codeCfg.strExt)); plstReport->SetSubItemText(i,2,SStringT().Format(_T("%d"),lineInfo.nCodeLines)); plstReport->SetSubItemText(i,3,SStringT().Format(_T("%d"),lineInfo.nBlankLines)); plstReport->SetSubItemText(i,4,SStringT().Format(_T("%d"),lineInfo.nRemarkLines)); } }
void CNewSkinDlg::OnOK() { xml_document xmlInit; if(xmlInit.load_file(m_pMainDlg->m_strInitFile)) { xml_node xmlSkins=xmlInit.first_child().child(L"skins"); if(!xmlSkins) xmlSkins=xmlInit.first_child().append_child(L"skins"); SStringT strSkinName=FindChildByName2<SRichEdit>(L"edit_skin_name")->GetWindowText(); if(strSkinName.IsEmpty()) { SMessageBox(GetActiveWindow(),_T("没有指定的皮肤名"),_T("错误"),MB_OK|MB_ICONSTOP); return; } SStringW strSkinNameW=S_CT2W(strSkinName); { //检查名字重复 xml_node xmlSkin=xmlSkins.first_child(); while(xmlSkin) { if(strSkinNameW==xmlSkin.attribute(L"name").value()) { SMessageBox(GetActiveWindow(),_T("指定的皮肤名与现有皮肤重复"),_T("错误"),MB_OK|MB_ICONSTOP); return; } xmlSkin=xmlSkin.next_sibling(); } } STabCtrl *pTabSkinType=FindChildByName2<STabCtrl>(L"tab_skin_type"); wchar_t szTypes[][20]={ L"imglist",L"imgframe",L"scrollbar",L"button",L"gradation" }; int iType=pTabSkinType->GetCurSel(); xml_node xmlSkin=xmlSkins.append_child(szTypes[iType]); xmlSkin.append_attribute(L"name").set_value(strSkinNameW); switch(iType) { case 0://imglist { SStringT strSrcName=FindChildByName2<SRichEdit>(L"edit_imglist_src_name")->GetWindowText(); xmlSkin.append_attribute(L"src").set_value(strSkinNameW); SStringT strStates=FindChildByName2<SRichEdit>(L"edit_imglist_states")->GetWindowText(); int nStates=_ttoi(strStates); if(nStates!=0) xmlSkin.append_attribute(L"states").set_value(nStates); if(FindChildByName(L"chk_imglist_vert")->IsChecked()) xmlSkin.append_attribute(L"vertical").set_value(L"1"); if(FindChildByName(L"chk_imglist_tile")->IsChecked()) xmlSkin.append_attribute(L"tile").set_value(L"1"); } break; case 1://imgframe { SStringT strSrcName=FindChildByName2<SRichEdit>(L"edit_imgframe_src_name")->GetWindowText(); xmlSkin.append_attribute(L"src").set_value(strSkinNameW); SStringT strStates=FindChildByName2<SRichEdit>(L"edit_imgframe_states")->GetWindowText(); int nStates=_ttoi(strStates); if(nStates!=0) xmlSkin.append_attribute(L"states").set_value(nStates); if(FindChildByName(L"chk_imgframe_vert")->IsChecked()) xmlSkin.append_attribute(L"vertical").set_value(L"1"); if(FindChildByName(L"chk_imgframe_tile")->IsChecked()) xmlSkin.append_attribute(L"tile").set_value(L"1"); SStringT strFrame=FindChildByName2<SRichEdit>(L"edit_imgframe_frame")->GetWindowText(); CRect rcMargin; int nSegs=_stscanf(strFrame,_T("%d,%d,%d,%d"),&rcMargin.left,&rcMargin.top,&rcMargin.right,&rcMargin.bottom); if(nSegs==4) { xmlSkin.append_attribute(L"left").set_value(rcMargin.left); xmlSkin.append_attribute(L"top").set_value(rcMargin.top); xmlSkin.append_attribute(L"right").set_value(rcMargin.right); xmlSkin.append_attribute(L"bottom").set_value(rcMargin.bottom); } } break; case 2://scrollbar { SStringT strSrcName=FindChildByName2<SRichEdit>(L"edit_imgframe_src_name")->GetWindowText(); xmlSkin.append_attribute(L"src").set_value(strSkinNameW); SStringT strMargin=FindChildByName2<SRichEdit>(L"edit_scrollbar_margin")->GetWindowText(); int nMargin=_ttoi(strMargin); if(nMargin>0) xmlSkin.append_attribute(L"margin").set_value(nMargin); if(FindChildByName(L"chk_scrollbar_hasgripper")->IsChecked()) xmlSkin.append_attribute(L"hasGripper").set_value(L"1"); if(FindChildByName(L"chk_scrollbar_inactive")->IsChecked()) xmlSkin.append_attribute(L"hasInactive").set_value(L"1"); } break; case 3://button { xmlSkin.append_attribute(L"colorUp").set_value(Color2Hex(FindChildByName2<SColorPicker>(L"crpk_bt1_up")->GetColor())); xmlSkin.append_attribute(L"colorDown").set_value(Color2Hex(FindChildByName2<SColorPicker>(L"crpk_bt1_down")->GetColor())); xmlSkin.append_attribute(L"colorUpHover").set_value(Color2Hex(FindChildByName2<SColorPicker>(L"crpk_bt2_up")->GetColor())); xmlSkin.append_attribute(L"colorDownHover").set_value(Color2Hex(FindChildByName2<SColorPicker>(L"crpk_bt2_down")->GetColor())); xmlSkin.append_attribute(L"colorUpPush").set_value(Color2Hex(FindChildByName2<SColorPicker>(L"crpk_bt3_up")->GetColor())); xmlSkin.append_attribute(L"colorDownPush").set_value(Color2Hex(FindChildByName2<SColorPicker>(L"crpk_bt3_down")->GetColor())); xmlSkin.append_attribute(L"colorUpDisable").set_value(Color2Hex(FindChildByName2<SColorPicker>(L"crpk_bt4_up")->GetColor())); xmlSkin.append_attribute(L"colorDownDisable").set_value(Color2Hex(FindChildByName2<SColorPicker>(L"crpk_bt4_down")->GetColor())); xmlSkin.append_attribute(L"colorBorder").set_value(Color2Hex(FindChildByName2<SColorPicker>(L"crpk_bt_border")->GetColor())); } break; case 4://gradation { xmlSkin.append_attribute(L"from").set_value(Color2Hex(FindChildByName2<SColorPicker>(L"crpk_gradation_from")->GetColor())); xmlSkin.append_attribute(L"to").set_value(Color2Hex(FindChildByName2<SColorPicker>(L"crpk_gradation_to")->GetColor())); xmlSkin.append_attribute(L"dir").set_value(FindChildByName(L"chk_gradation_dir")->IsChecked()?L"vert":L"horz"); } break; } //save xml FILE *f=_tfopen(m_pMainDlg->m_strInitFile,_T("wb")); if(f) { xml_writer_file xmlPrinter(f); xmlInit.print(xmlPrinter); fclose(f); m_pMainDlg->InitSkinList(); } } EndDialog(IDOK); }
void CFolderHander::OnDirEnterFinish( EventArgs *pEvt ) { SEdit *pEdit = sobj_cast<SEdit>(pEvt->sender); SStringT strDir = pEdit->GetWindowText(); InitDir(S_CT2W(strDir),TRUE); }
BOOL SMessageBoxImpl::OnInitDialog( HWND wnd, LPARAM lInitParam ) { pugi::xml_node uiRoot=s_xmlMsgTemplate.child(L"SOUI"); InitFromXml(uiRoot); UINT uType = s_MsgBoxInfo.uType&0x0F; STabCtrl *pBtnSwitch= FindChildByName2<STabCtrl>(NAME_MSGBOX_BTNSWITCH); SASSERT(pBtnSwitch); pBtnSwitch->SetCurSel(g_msgBtnText[uType].nBtns-1); SWindow *pBtnPanel=pBtnSwitch->GetItem(g_msgBtnText[uType].nBtns-1); SASSERT(pBtnPanel); pugi::xml_node nodeBtnTxt = s_xmlMsgTemplate.child(L"SOUI").child(L"buttonText"); for(int i=0; i<g_msgBtnText[uType].nBtns; i++) { SWindow *pBtn=pBtnPanel->FindChildByName(g_wcsNameOfBtns[i]); int nID = g_msgBtnText[uType].btnInfo[i].uBtnID; pBtn->SetID(nID); SStringT strText = OnGetButtonText(nID); if(strText.IsEmpty()) { const wchar_t *pBtnText = g_msgBtnText[uType].btnInfo[i].szText; //先从模板中的buttonText节点里查按钮的文字 pugi::xml_node nodeTxt = nodeBtnTxt.child(pBtnText); if(nodeTxt) pBtnText=nodeTxt.text().get(); //从翻译引擎中翻译 strText = S_CW2T(TR(pBtnText,GetTranslatorContext())); } pBtn->SetWindowText(strText); } const wchar_t *pszFrameAttr=uiRoot.attribute(L"frameSize").value(); CRect rcFrame; swscanf(pszFrameAttr,L"%d,%d,%d,%d",&rcFrame.left,&rcFrame.top,&rcFrame.right,&rcFrame.bottom); CSize szMin; const wchar_t *pszMinAttr=uiRoot.attribute(L"minSize").value(); swscanf(pszMinAttr,L"%d,%d",&szMin.cx,&szMin.cy); SWindow * pTitle= FindChildByName(NAME_MSGBOX_TITLE); SASSERT(pTitle); pTitle->SetWindowText(S_CW2T(TR(s_MsgBoxInfo.pszCaption?S_CT2W(s_MsgBoxInfo.pszCaption):L"prompt",GetTranslatorContext()))); SWindow * pMsg= FindChildByName(NAME_MSGBOX_TEXT); SASSERT(pMsg); pMsg->SetWindowText(S_CW2T(TR(S_CT2W(s_MsgBoxInfo.pszText),GetTranslatorContext()))); OnSetIcon(s_MsgBoxInfo.uType); pMsg->GetRoot()->UpdateLayout(); CSize szText = pMsg->GetDesiredSize(NULL); CRect rcText = pMsg->GetWindowRect();//获取msg的左边位置 CSize szWnd; szWnd.cx=max(szMin.cx,rcText.left + szText.cx + rcFrame.right); szWnd.cy=max(szMin.cy,rcFrame.top + szText.cy + rcFrame.bottom); SetWindowPos(0,0,0,szWnd.cx,szWnd.cy,SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER); pMsg->GetRoot()->UpdateLayout(); //将msg text的上下位置设置成和parent相同。 rcText = pMsg->GetWindowRect(); CRect rcTextParent = pMsg->GetParent()->GetWindowRect(); rcText.top = rcTextParent.top; rcText.bottom = rcTextParent.bottom; pMsg->Move(rcText); CenterWindow(); return 0; }