CTaskDialog::SetExpansionArea
void SetExpansionArea(
const CString& strExpandedInformation,
const CString& strCollapsedLabel = _T(""),
const CString& strExpandedLabel = _T("")
);
參數
[in] strExpandedInformation
CTaskDialog 在對話方塊的主體中顯示的字串,當使用者按一下展開按鈕。[in] strCollapsedLabel
在 CTaskDialog 展開按鈕旁顯示的字串,在展開的區域會摺疊。[in] strExpandedLabel
在 CTaskDialog 展開按鈕旁顯示的字串,在展開的區域隨即顯示。
備註
CTaskDialog 類別 展開的區域可讓您提供其他資訊給使用者。 展開區域在 CTaskDialog的主要部分,緊跟著在標頭和內容的字串。
當 CTaskDialog 第一次顯示時,它不會顯示展開的資訊並不在展開按鈕旁邊放置 strCollapsedLabel 。 當使用者按一下展開按鈕時, CTaskDialog 顯示 strExpandedInformation 並將標籤加入至 strExpandedLabel。
範例
// TODO: Replace the strings below with the appropriate message,
// main instruction, and dialog title
CString message("This is an important message to the user.");
CString mainInstruction("Important!\nPlease read!");
CString title("Alert Dialog");
CTaskDialog taskDialog(message, mainInstruction, title,
TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON );
// Setting new information to be able to reuse the dialog resource
taskDialog.SetWindowTitle(L"New title for the task dialog");
taskDialog.SetContent(L"New message to show the user.");
taskDialog.SetMainInstruction(L"Even more important!");
taskDialog.SetMainIcon(TD_ERROR_ICON);
taskDialog.SetDialogWidth(300);
// Add a footer
taskDialog.SetFooterText(L"Footer information for the dialog.");
taskDialog.SetFooterIcon(TD_INFORMATION_ICON);
// Add expansion information
taskDialog.SetExpansionArea(L"Additional information\non two lines.",
L"Click here for more information.",
L"Click here to hide the extra information.");
// Change the options to show the expanded information by default.
// It is necessary to retrieve the current options first.
int options = taskDialog.GetOptions();
options |= TDF_EXPANDED_BY_DEFAULT;
taskDialog.SetOptions(options);
taskDialog.DoModal();
需求
標題: afxtaskdialog.h