MDI选项卡控件标题更改

MDI选项卡控件标题更改

本文介绍了MFC MDI选项卡控件标题更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了没有文档/视图体系结构的应用程序.原因是它不是基于文件的,它主要与数据库有关.大多数情况下,我用于报告.在进一步探讨这个问题之前,我确实在google中寻找解决方案.没有足够的帮助.

当我这样做的时候:
当用户打开报告窗口时,它的顶部有一个基本标题.在用户选择一个客户并请求显示数据后,一堆语句改变了标签栏的标题.到目前为止,这很好.这行得通.代码如下:

I have created my Application without Document/View Architecture. Reason is its not file based, its mostly related with database. Mostly I am using for Reporting. And before I go any further with the question, I did look for the solution in google. Not enough help.

When I did:
when user open a report window it has a basic caption at the top. After user select a Customer and request to display the data, a bunch of statement do the change of the caption of the tab bar. So far this is good. It work. Code is as below:

CWnd *pr=this->GetParent();
pr->SetWindowTextW(ch);



我面临的问题是:
1.当我最小化代码时,标题已更改为初始标题.
2.当我在新标签页中打开一个新窗口时,上一个窗口会立即丢失标题.

一直保持下去的正确方法是什么?

在此先感谢



The problem i am facing is :
1. When I minimize the code Caption got changed to the initial caption.
2. When I open a new window in new tab the previous window lost the caption immediately.

What can be the proper way to keep it all the time?

Thanks in advance

推荐答案

BOOL CMyFrame::PreCreateWindow(CREATESTRUCT& cs)
{
    // Style FWS_ADDTOTITLE is always set when creating a frame window.
    // See CDocTemplate::CreateNewFrame() in doctmpl.cpp
    cs.style &= ~FWS_ADDTOTITLE;
    // Change CFrameWnd to the base class if necessary
    return CFrameWnd::PreCreateWindow(cs);
}


这篇关于MFC MDI选项卡控件标题更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 08:36