==急用。怎样禁止 PropertySheet 的“帮助”按钮?==

zPerry 2003-05-17 10:35:57
我用 CPropertySheet 编了一个向导(Wizzard),可是下面总有一个“帮助”按钮,点击后提示无法找到帮助文件。请问如何去掉或者禁止这个按钮,或者让他点击后没有反应也可以?
我用的是 VC++.net(MFC项目) 和 WinXP, 不知是否和系统有关系?
...全文
178 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
zPerry 2003-05-21
  • 打赏
  • 举报
回复
多谢各位大虾相助,最后在 MSDN 中找到了答案,原来CPropertyPage和CPropertySheet要同时设定。

Visual C++ 概念:添加功能
在属性表中使用帮助:CPropertySheet 和 CPropertyPage

请参见 MFC 应用程序中的区分上下文帮助 | CPropertyPage | CPropertySheet

CPropertySheet 类的对象表示属性表,也称为选项卡对话框。每个属性表由一个 CPropertySheet 对象和一个以上的 CPropertyPage 对象组成。属性表被框架显示为带有一组选项卡索引的窗口。用户使用这组索引选择当前页和当前选定页的某区域。

CPropertySheet 中的帮助只受 F1 键和“帮助”按钮的支持。默认情况下“帮助”按钮出现在应用程序的框架中。用户不需要进行干预。在用户为属性表中的各页添加帮助信息时,单击“帮助”按钮,帮助机制就会自动显示该页的帮助。

若要从属性表中移除“帮助”按钮,请修改属性表和其中的所有页,如下所示:

mySheet.m_psh.dwFlags &= ~PSH_HASHELP;
page1.m_psp.dwFlags &= ~PSP_HASHELP;
page2.m_psp.dwFlags &= ~PSP_HASHELP;
mySheet.AddPage( &page1 );
mySheet.AddPage( &page2 );
mySheet.DoModal();
m_psh 变量为 PROPSHEETHEADER 类型。m_psp 变量为 PROPSHEETPAGE类型。如果清除了所有的 HASHELP 标志(PSH_HASHELP 表示属性表对象,PSP_HASHELP 表示属性页),则创建的属性表不带“帮助”按钮。
GoogleGeek 2003-05-17
  • 打赏
  • 举报
回复
不可能的!
你是怎么创建wizard的?
默认的情况下没有你这种情况呀!?
zPerry 2003-05-17
  • 打赏
  • 举报
回复
Up
zPerry 2003-05-17
  • 打赏
  • 举报
回复
psusong(爱因思念-闭关修炼中...)
我用了你的方法,好像还是不行。
我在 DoModal() 之前设了~(PSH_HASHELP)
另 The m_psh variable is of type PROPSHEETPAGE. 好像没找到。
GoogleGeek 2003-05-17
  • 打赏
  • 举报
回复
// This code fragment shows how to change CPropertySheet's settings
// before it is shown.

CPropertySheet dlgPropertySheet("Simple PropertySheet");

CStylePage stylePage;
CColorPage colorPage;
dlgPropertySheet.AddPage(&stylePage);
dlgPropertySheet.AddPage(&colorPage);
dlgPropertySheet.m_psh.dwFlags &= ~(PSH_HASHELP);
dlgPropertySheet.m_psh.pszCaption = "Simple";
dlgPropertySheet.m_psh.nStartPage = 1;

dlgPropertySheet.DoModal();

//给分吧!老兄!
呵呵!!!
GoogleGeek 2003-05-17
  • 打赏
  • 举报
回复
Using Help in Property Sheets
Help in CPropertySheet is supported by the F1 key and the Help button only. The Help button appears in the application framework by default. No intervention by the user is necessary. When the user adds the help information for each of the pages inside the property sheet, the help mechanism automatically displays the help for that page when the Help button is clicked.

You can deactivate the Help button capability by modifying m_psh in the property sheet object as follows:

mySheet.m_psh.dwFlags &= ~(PSH_HASHELP);

You can activate the Help button again with the following:

mySheet.m_psh.dwFlags |= PSH_HASHELP;

The m_psh variable is of type PROPSHEETPAGE. The dwFlags field of m_psh determines if the Help button of the property sheet (the parent of the property page) is enabled or disabled.

zPerry 2003-05-17
  • 打赏
  • 举报
回复
老兄,说清楚点好吗?谢了?
GoogleGeek 2003-05-17
  • 打赏
  • 举报
回复
很easy!
BinaryPoet 2003-05-17
  • 打赏
  • 举报
回复
不好意思,看错了!呵呵!
GoogleGeek 2003-05-17
  • 打赏
  • 举报
回复
to 楼上
老大,不是“应用”按钮呀?
看清出一点!!
BinaryPoet 2003-05-17
  • 打赏
  • 举报
回复
1.GetDlgItem(ID_APPLYNOW)->EnableWindow(FALSE),就禁止了。
2.m_psh.dwFlags |= PSH_NOAPPLYNOW,就干脆没有这个按钮了。
GoogleGeek 2003-05-17
  • 打赏
  • 举报
回复
上面的几种方法在我这边都可以的!!
我得系统的是windows2000 advanced server +vc6.0sp5
GoogleGeek 2003-05-17
  • 打赏
  • 举报
回复
你要是是在不行的话,你把那个按钮隐藏掉吧或者禁用!
例如:
在你的sheet中响应消息WM_INITDIALOG
BOOL CDemoSheet::OnInitDialog()
{
CPropertySheet::OnInitDialog();

// TODO: Add extra initialization here
CWnd *pWnd=this->GetDlgItem(IDHELP);
if(pWnd!=NULL);
{
pWnd->EnableWindow(false);
pWnd->ShowWindow(SW_HIDE);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧