积极答复者
ribbon控件如何隐藏?

问题
答案
-
搜索了一下,有人报过类似的Bug给MS:
https://connect.microsoft.com/VisualStudio/feedback/details/414407/cmfcribbonbaseelement-setvisible-does-not-workVisual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE/Windows Mobile platform embedded development.
- 已标记为答案 Shu 2017 2014年9月2日 9:08
全部回复
-
你好:
据我所知CMFCR’ibbonProgressBar类既不是继承于CHtmlview 也不是CWnd类,所以他既不能用SetVisible方法也不能用ShowWindow(FALSE)方法。如果你一定要隐藏这个进度条的话,首先你要创建一个新的类继承于CMFCR’ibbonProgressBar, 然后重载OnDraw方法,设计你的ondraw方法,类似于这样:
头文件里 class CMyprogressbar : public CMFCRibbonProgressBar { public: CMyprogressbar(); virtual ~CMyprogressbar(); virtual void OnDraw(CDC* pDC); };
实现
#include "stdafx.h" #include "ribbonTest.h" #include "Myprogressbar.h" // CMyprogressbar CMyprogressbar::CMyprogressbar() { } CMyprogressbar::~CMyprogressbar() { } // CMyprogressbar member functions void CMyprogressbar::OnDraw(CDC *pDC) { BOOL m_bIsVisible=FALSE; if(m_bIsVisible) { CMFCRibbonProgressBar::OnDraw(pDC); } }
这样一来你用CMyprogressbar类创建的progressbar都是不可见的了,我不建议你这样做,没什么实际意义,你可以参照我的代码试一下。
有什么问题可以继续在论坛里提问。
Shu Hu
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey. -
我的代码吗?额,在我的电脑上可以的啊。
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey. -
搜索了一下,有人报过类似的Bug给MS:
https://connect.microsoft.com/VisualStudio/feedback/details/414407/cmfcribbonbaseelement-setvisible-does-not-workVisual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE/Windows Mobile platform embedded development.
- 已标记为答案 Shu 2017 2014年9月2日 9:08