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的主要部分,将立即在titles和目录字符串的下。
当 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