在使用CPropertySheet中,怎么设置其中的某一个page为不可点击呢?设置之后
怎么做又可以点击呢

解决方案 »

  1.   

    你所说的不可点击是否指属性页某个页面的暂时锁定,如是,请参考以下内容
    //实现属性页页面的锁定一、实现思想 
    1、在Sheet类中定义一个变量,保存待锁定页的索引值
    int m_nLastActive;
    2、处理Sheet类中的TCN_SELCHANGING通知,调用GetActiveIndex()函数,判断当前要显示的页面的索引值是否与m_nLastActive相同。3、如果索引值与m_nLastActive不同,则按如下方式发送消息,以锁定显示:
    PostMessage (PSM_SETCURSEL, m_nLastActive);二、实现步骤(假设我们锁定第一页,m_nLastActive值置为0)
    1、覆盖Sheet类的OnNotify函数
    BOOL CMyPropertySheet::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) 
    {
    NMHDR* pnmh = (NMHDR*)lParam;
    // tab is about to change
    if (TCN_SELCHANGING == pnmh->code)
    // save the current page index
    m_nLastActive = GetActiveIndex ();
    // tab has been changed
    else if (TCN_SELCHANGE == pnmh->code)
    {
    // get the current page index
    int nCurrentPage = GetActiveIndex ();
    // if current page is in our map of disabled pages
    if (m_nLastActive != nCurrentPage)
    // activate the previous page
    PostMessage (PSM_SETCURSEL, m_nLastActive);
    }
    return CPropertySheet::OnNotify(wParam, lParam, pResult);
    }测试一下吧,除第一页外都被禁用了,达到了锁定第一页的目的。
    对于不想所定的情况,可以在调用PostMessage (PSM_SETCURSEL, m_nLastActive);语句之前做下判断即可。