开发者

MFC share one static label on all the views of the application

开发者 https://www.devze.com 2023-03-25 04:42 出处:网络
I am working on 开发者_运维知识库a C++ MFC application. I am wondering if I can make a Static label or button that can exist in all the Views of the application without re-writing code.

I am working on 开发者_运维知识库a C++ MFC application. I am wondering if I can make a Static label or button that can exist in all the Views of the application without re-writing code.

I want this label to appear on almost all the views of the application and update dynamically depending on the user actions.

Thanks in advance.


I think the easiest way to do what you want would be to create a base class view with the button or label created programmatically (rather than using the resource editor) as member variables. Then inherit all your other views from that base class and you'll still have the button/label to show, hide or update as necessary.


Not sure what you mean by "no rewrite".

Easiest way is to subclass your view class to paint that static label, and listen to windows message so that the labels can be painted differently.

0

精彩评论

暂无评论...
验证码 换一张
取 消