使用EnableWindow( TRUE/FALSE )
解决方案 »
- MFC中的ActiveX空间能播放哪些格式的视频文件?
- 无法解析的外部符号错误,实在找不出原因,求助
- BeginePaint如何工作
- 测试本机是否连接Internet的函数,怎么微软提供的API函数没有一个准确的呢? 请高手务必帮忙.
- 求助:vc6中的一个链接错误
- 如何调用WIN2000的信使服务
- 求:《Visual C++开发GIS系统》书的配套源码下载############################
- wnd::SetTimer()的OnTimer()事件的问题
- 关于*.mak文件的小Case
- 编程访问SQL SERVER数据库进行查询操作时,下面两种方法哪种对程序的性能和执行效率好些?
- 怎么 VC 和 BC 的 cos, sin 不准确????
- 鼠标在标题栏中可以通过鼠标拖动来实现窗口的移动 如何在客户区中实现那个功能(Dialog)
// OnInitDialog is the handler for WM_INITDIALOG.
BOOL CMyFileDialog::OnInitDialog()
{
CFileDialog::OnInitDialog(); CWnd* pWndParent = GetParent(); // Make sure you add #include <dlgs.h> for IDs 'edt1' & 'stc3'.
// Disables the 'file name' edit and static control
// of the standard file open dialog. //Get handle of 'file name' edit control & disable it.
CWnd* pWnd = pWndParent->GetDlgItem(edt1);
pWnd->EnableWindow(FALSE); // Get handle of 'file name' static control & disable it.
pWnd = pWndParent->GetDlgItem(stc3);
pWnd->EnableWindow(FALSE);
return TRUE;
}
{
// TODO: Add your control notification handler code here
UpdateData(true);
if (m_status=="1"){ //m_status为下拉框变量
GetDlgItem(IDC_status1)->EnableWindow(true);
}else{
GetDlgItem(IDC_status1)->EnableWindow(false);
}
}
这段代码,可以实现变灰功能,
但是只能当我选择1的时改变选项,才能变或不变灰,
而我需要的是我一选择1,就变灰或不变灰,怎么才能实现???
int status;//在头文件中声明UpdateData(false);
if (status=="1"){
GetDlgItem(IDC_status1)->EnableWindow(true);
}else{
GetDlgItem(IDC_status1)->EnableWindow(false);
}
UpdateData(true);其中status是与你窗口中的控件相对应的!!