我在msdn中只查到如何去处HELP按钮,本想依样画葫芦去除应用按扭
dlg.m_psh.dwFlags &= PSH_NOAPPLYNOW;
可是程序运行时出错,请大侠指点
dlg.m_psh.dwFlags &= PSH_NOAPPLYNOW;
可是程序运行时出错,请大侠指点
解决方案 »
- 我想改变对话框大小?具体如何操作,代码怎么用?我是菜鸟,求详细
- 用CFileFind读取的文件名,全角的圆点变成了问号,其它字符没问题
- 求助:VC++中,一个界面能布置多少控件?
- 初学者-手动添加资源ID
- 菜鸟求助如何在VC++6.0中实现调色板
- 我在制作工具条,在MainFrame的OnCreate里,写了这样一段为什么有错??我做得是跟IE效果一样的。
- pDC->TextOut不支持中文怎么办?
- WinApp::OnPaint()\WinMainFrame::OnPaint()\WinView::OnPaint()\WinView::OnDraw()有什么区别?
- 如何一次性关闭sdi主窗体中打开的所有非模态对话框
- 。。。。。。。。。求指点
- 100分求救!如何自绘MF_POPUP风格的菜单!
- ***想进清华同方软件公司的,到这里来***
SetModified(TRUE); //使Apply按钮允许或者
This is the code showing how I did mine for a test app.BOOL CLearnerAppSheet::OnInitDialog()
{
CPropertySheet::OnInitDialog();
CButton* button; // Remove the "Apply" button... button = (CButton*) GetDlgItem(ID_APPLY_NOW);
button->DestroyWindow(); // Remove the "OK" button... button = (CButton*) GetDlgItem(IDOK);
button->DestroyWindow(); // Remove the "Cancel" button... button = (CButton*) GetDlgItem(IDCANCEL);
button->DestroyWindow(); // Set the dialog icons... SetIcon(m_hIcon, TRUE); return TRUE;
}I removed three of the four buttons this way... I think
that HELP is nice where it is at if you are making an app
that has the app on one page and the controls on the next
page.Using this method to DestroyWindow() HELP button causes
errors.
CWnd *p=GetDlgItem (IDOK);
p->DestroyWindow ();//隐藏OK
dlg.m_psh.dwFlags &= PSH_NOAPPLYNOW而是dlg.m_psh.dwFlags |= PSH_NOAPPLYNOW
The information in this article applies to:The Microsoft Foundation Classes (MFC), used with:
Microsoft Visual C++ for Windows, 16-bit edition, version 1.52
Microsoft Visual C++, 32-bit Editions, versions 2.0, 2.1, 2.2, 4.0--------------------------------------------------------------------------------
SUMMARY
A modal CPropertySheet will automatically create an Apply button. To hide this button, you need to use different methods for different versions of MFC. In Visual C++ 2.2 and earlier (MFC 3.2 and earlier), you can derive a class from CPropertySheet, override OnCreate(), call GetDlgItem(ID_APPLY_NOW), and finally call ShowWindow(SW_HIDE) to hide the Apply button. In Visual C++ 4.0 (MFC 4.0), CPropertySheet has a public member called m_psh. m_psh is a PROPSHEETHEADER structure with a dwFlags member. One of the possible values of m_psh.dwFlags is PSH_NOAPPLYNOW. Setting this value before the call to DoModal() hides the Apply button. Another option in Visual C++ 4.0 is to call GetDlgItem()/ShowWindow(), but you should do it in OnInitDialog() instead of OnCreate(). MORE INFORMATION
In Visual C++ 2.2 and earlier, CPropertySheet was implemented internally by MFC. Starting with Visual C++ 4.0, the CPropertySheet uses the Windows 95 PropertySheet control, so the method for hiding the Apply button changed. You can hide any of the default buttons in a modal property sheet by using the methods in this article. The IDs for each button are IDOK (OK button), IDCANCEL (Cancel button), ID_APPLY_NOW (Apply button), and IDHELP (Help button). Note that the Apply button is disabled by default until you call SetModified(). In addition, in Visual C++ 4.0, the Help button is not shown by default. To show it, you can set m_psh.dwFlags |= PSH_HASHELP. Sample Code/***** this code applies to Visual C++ 4.0 and later *****/
void CMyView::OnDisplayModalSheet()
{
CMySheet sheet ("Set Properties");
// this hides the Apply button
sheet.m_psh.dwFlags |= PSH_NOAPPLYNOW;
sheet.DoModal ();
}/* You can also do the following to hide the Apply button */ BOOL CMySheet::OnInitDialog()
{
CPropertySheet::OnInitDialog(); // this hides the Apply button
CWnd* pApplyButton = GetDlgItem (ID_APPLY_NOW);
ASSERT (pApplyButton);
pApplyButton->ShowWindow (SW_HIDE); return TRUE;
}
/*********************************************************/ /***** this code applies to Visual C++ 2.2 and earlier *****/
int CMySheet::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CPropertySheet::OnCreate(lpCreateStruct) == -1)
return -1; // this hides the Apply button
CWnd* pApplyButton = GetDlgItem (ID_APPLY_NOW);
ASSERT (pApplyButton);
pApplyButton->ShowWindow (SW_HIDE); return 0;
}
/*********************************************************/ Additional query words: kbinf 1.52 2.00 2.10 2.20 4.00 Keywords : kbcode kbMFC kbPropSheet KbUIDesign kbVC152 kbVC200 kbVC210 kbVC220 kbVC400 kbGrpMFCATL
Version : winnt:2.0,2.1,2.2,4.0
Platform : winnt
Issue type : kbhowto
Technology : kbvc
Last Reviewed: March 13, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.
--------------------------------------------------------------------------------
Send feedback to MSDN.Look here for MSDN Online resources.