如何从属性表中删除确定,取消和应用按钮

时间:2018-01-02 07:54:30

标签: c++ visual-c++ mfc cpropertysheet

所以我尝试使用此代码并且它无法正常工作:

CButton *btnApply;
btnApply = reinterpret_cast<CButton *>(GetDlgItem(IDOK));
btnApply->ShowWindow(FALSE);

提前致谢。

2 个答案:

答案 0 :(得分:5)

使用 public class MainActivity extends AppCompatActivity { RecyclerView recyclerView; List<Message> mList; RecycleAdapter recycleAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mList=new ArrayList<>(); mList.add(new Message("Hello Trippin","12:00")); mList.add(new Message("Whats good","15:02")); recyclerView=(RecyclerView) findViewById(R.id.recycler); recycleAdapter=new RecycleAdapter(mList); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.setAdapter(recycleAdapter); } } 隐藏PropertySheet中的应用按钮

PSH_NOAPPLYNOW

隐藏确定和取消按钮可以在CMyPropertySheet psheet; psheet.m_psh.dwFlags |= PSH_NOAPPLYNOW; psheet.DoModal(); 中处理,需要父窗口的句柄,因为按钮位于父窗口而非页面窗口中:

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;
}

答案 1 :(得分:0)

在属性表中:

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 )
}