所以我尝试使用这段代码,但它不起作用:
CButton *btnApply;
btnApply = reinterpret_cast<CButton *>(GetDlgItem(IDOK));
btnApply->ShowWindow(FALSE);
提前致谢。
所以我尝试使用这段代码,但它不起作用:
CButton *btnApply;
btnApply = reinterpret_cast<CButton *>(GetDlgItem(IDOK));
btnApply->ShowWindow(FALSE);
提前致谢。
用于PSH_NOAPPLYNOW
隐藏 PropertySheet 中的应用按钮
CMyPropertySheet psheet;
psheet.m_psh.dwFlags |= PSH_NOAPPLYNOW;
psheet.DoModal();
隐藏 OK 和 Cancel 按钮可以在 中处理CPropertyPage
,需要父窗口的句柄,因为按钮在父窗口中而不是在页面窗口中:
BOOL CMyPropertyPage::OnSetActive()
{
BOOL res = CPropertyPage::OnSetActive();
CPropertySheet* psheet = (CPropertySheet*)GetParent();
psheet->GetDlgItem(IDOK)->ShowWindow(SW_HIDE);
psheet->GetDlgItem(IDCANCEL)->ShowWindow(SW_HIDE);
return res;
}
或在属性表中:
BOOL CMyPropertySheet::OnInitDialog()
{
BOOL res = CPropertySheet::OnInitDialog();
GetDlgItem(IDOK)->ShowWindow(SW_HIDE);
GetDlgItem(IDCANCEL)->ShowWindow(SW_HIDE);
return res;
}
在您的属性表中:
BOOL CMyPropertySheet::OnInitDialog()
{
CWnd *pWnd = GetParent()->GetDlgItem(IDHELP);
pWnd->ShowWindow( FALSE );
CWnd *pWnd1 = GetParent()->GetDlgItem(IDCANCEL);
pWnd1->ShowWindow( FALSE );
CWnd *pWnd2 = GetParent()->GetDlgItem(IDOK);
pWnd2->ShowWindow( FALSE );
CWnd *pWnd3 = GetParent()->GetDlgItem(0x3021);// 0x3021 == IDAPPLY
pWnd3->ShowWindow( FALSE )
}