设为首页 加入收藏

TOP

CFileDialog的各种风格的目录/文件夹选择对话框---(CFolderDialog)(三)
2014-11-23 20:17:46 】 浏览:836
Tags:CFileDialog 各种 风格 目录 文件夹 选择 对话 --- CFolderDialog
WindowRect(rectText);
pFD->ScreenToClient(rectText);
pFD->GetDlgItem(stc3)->SetWindowPos(0, rectList2.left, rectCancel.top + 6, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
SetControlText(stc3, _T("Selected:"));

//ComboBox of current file
CRect rectComBo;
pFD->GetDlgItem(cmb13)->GetWindowRect(rectComBo);
pFD->ScreenToClient(rectComBo);
pFD->GetDlgItem(cmb13)->SetWindowPos(0, rectText.left + rectText.Width() - 40, rectCancel.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE);

//Set OK Button Position
CRect rectOK;
pFD->GetDlgItem(IDOK)->GetWindowRect(rectOK);
pFD->ScreenToClient(rectOK);
pFD->GetDlgItem(IDOK)->SetWindowPos(0, rectCancel.left - rectOK.Width() - 2, rectCancel.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
SetControlText(IDOK, _T("Select"));

pFD->SetWindowText(_T("Choose folder"));
pFD->CenterWindow();
m_wndProc = (WNDPROC)SetWindowLong(pFD->m_hWnd, GWL_WNDPROC, (long)WindowProcNew);
}

//Change the combobox context when select folder.
void CFolderDialog::OnFileNameChange()
{
ChangeFolder();
}

//If the folder contains no sub folder, the OnFileNameChange will not be triggered.
//Add this OnFolderChange to double sure even if there is no sub folder.
void CFolderDialog::OnFolderChange()
{
ChangeFolder();
}

//Change the combobox text to current selected folder
void CFolderDialog::ChangeFolder()
{
TCHAR path[MAX_PATH] = {0};
GetCurrentDirectory(MAX_PATH, path);
SetControlText(cmb13, path);
}
调用:


[cpp]print CString folderPath;
CFolderDialog dlg(&folderPath, this);
if(IDOK == dlg.DoModal())
{
UpdateData(false);
}
CString folderPath;
CFolderDialog dlg(&folderPath, this);
if(IDOK == dlg.DoModal())
{
UpdateData(false);
}


3. 复杂的但是功能比较全的窗口XFolderDialog:

界面:

链接:http://www.codeproject.com/KB/dialog/XFolderDialog.aspx

摘自 w174504744
首页 上一页 1 2 3 4 下一页 尾页 3/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇实战VC时间控制函数 下一篇vector彻彻底底干干净净清理内存..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目