CTaskDialog::SetProgressBarState
設定進度列的狀態並將它顯示在 CTaskDialog。
void SetProgressBarState(
int nState = PBST_NORMAL
);
參數
- [in] nState
進度列的狀態。 的可能值。請參閱<備註>一節。
備註
這個方法會擲回。 ENSURE (MFC) 巨集的例外狀況,如果 CTaskDialog 已顯示且具有跑馬燈進度列。
下表列出 nState的可能值。 在這些情況下,進度列以一般的色彩填滿,直到達到指定的位置停止。 此時便會根據這個狀態的色彩。
PBST_NORMAL
在進度列填滿之後, CTaskDialog 不會變更 列的色彩。 根據預設,規則色彩為綠色。PBST_ERROR
在進度列填滿之後, CTaskDialog 變更此列的色彩變更為錯誤色彩。 根據預設,這是紅色。PBST_PAUSED
在進度列填滿之後, CTaskDialog 變更此列的色彩變更為暫停的色彩。 根據預設,這是黃色的。
您可以設定進度列停止並 CTaskDialog::SetProgressBarPosition的位置。
範例
// 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 );
// Add a marquee progress bar.
taskDialog.SetProgressBarMarquee();
taskDialog.DoModal();
// Remove the marquee bar and replace it with a standard progress bar
taskDialog.SetProgressBarMarquee(0);
taskDialog.SetProgressBarRange(0, 100);
taskDialog.SetProgressBarPosition(75);
taskDialog.SetProgressBarState();
taskDialog.DoModal();
需求
標題: afxtaskdialog.h
請參閱
參考
CTaskDialog::SetProgressBarMarquee