MFC CMFCVisualManager替代 [英] MFC CMFCVisualManager Override

查看:98
本文介绍了MFC CMFCVisualManager替代的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图覆盖CMFCVisualManager上的某些功能来自定义我的功能区.因此,我创建了一个类并从该类派生.

I'm trying to override some functions on CMFCVisualManager to customize my ribbon. So I created a class and derived from it.

void CMyVisualManager::OnDrawRibbonCategory(CDC* pDC, CMFCRibbonCategory* pCategory, CRect rectCategory)

现在这可以工作并且可以更改颜色等,但是有些功能我无法或重写或无法正确执行

Now this works and can change colors etc, but there are some functions that I cant or override or not doing it right like

void CMyVisualManager::OnDrawRibbonLaunchButton(CDC* pDC, CMFCRibbonLaunchButton* pButton, CMFCRibbonPanel* pPanel)

我的方法没有覆盖原始方法,并且原始函数被调用

My method doesnt override the original, and the original function gets called

但是 https://msdn.microsoft.com/zh-cn/subscriptions/downloads/65a24718-8128-43f9-973d-25262bdceae7(v=vs.90) 说它可以被覆盖.

But https://msdn.microsoft.com/en-us/subscriptions/downloads/65a24718-8128-43f9-973d-25262bdceae7(v=vs.90) says it can be overridden.

如果有人能指出正确的方向,我一直在寻找,但找不到答案谢谢

If anyone can point me in the right direction, I've been looking but can't find an answer thanks

推荐答案

是的,您可以覆盖类中的函数.

Yes you override a function in your class.

但是您不是由视觉管理员创建的.因此,它永远不会被使用. 当您的程序启动时,将创建可视管理器的实例.并使用此实例.

But you visual manager isn't the one that is created. So it is never used. When your program starts an instance of the visual manager is created. And this instance is used.

仅当您还强制MFC使用可视管理器时,才会使用覆盖的功能.

Only if you also force the MFC to use your visual manager your overriden functions are used.

可以在程序的InitInstance中将 SetDefaultManager 与您的类的运行时类一起使用.

There for use SetDefaultManager with the runtime class of your class in InitInstance of your program.

这篇关于MFC CMFCVisualManager替代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆