MFC 控件隐藏在 Windows 7 基本主题上

发布于 2024-11-14 09:47:53 字数 1539 浏览 1 评论 0原文

谁能告诉我为什么 MFC 应用程序在 Windows 7 基本主题中无法正确显示?

编辑:有人能猜出这个问题吗?

编辑:

  • 我使用 vs2008 (相同版本用于创建此应用程序)。
  • 这个特定的窗口是基于 DLL 的。为了创建该 DLL,我在 Stdafx.h 中添加了这些

#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
  • 此问题仅出现在该窗口中。
  • 这个窗口是基于CDialog的,在OnInitDialog()里面我正在做这些,

CDialog::OnInitDialog();
AfxInitRichEdit();
// And Create three more child windows.
  • 这就是它在基本主题中的显示方式。

在此处输入图像描述

但是,当我更改为 Windows Aero 主题时,它运行良好。

在此处输入图像描述 解决办法应该是什么?

编辑:请问有人吗?

Can anyone please tell me why MFC applications are not displaying correctly in Windows 7 basic theme ?

EDIT: Is there anyone who can guess the problem ?

EDIT:

  • Im using vs2008 (same version is used to create this app).
  • This particular window is DLL based.For creating that DLL I added these in the Stdafx.h

.

#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
  • This problem occurs only in this window.
  • This window is based on CDialog, inside OnInitDialog() I'm doing these,

.

CDialog::OnInitDialog();
AfxInitRichEdit();
// And Create three more child windows.
  • This is how it displayed in basic theme.

enter image description here

But, it is working nicely when I changed to Windows Aero theme.

enter image description here
What should be the solution ?

EDIT: Anyone please ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

盗琴音 2024-11-21 09:47:53
  • 建议在Application类的InitInstance函数中初始化richedit控件。我不确定它是否能与 OnInitDialog 一起正常工作。
  • 从项目设置中检查您的程序/DLL 是否为 UNICODE 代码。
  • 默认情况下,Visual Studio 2008 将为程序生成清单(对于 EXE)。
  • 仅当应用程序是 UNICODE 时才必须嵌入清单。

请检查一下。

  • It's advisable to initialize richedit control in the InitInstance function of Application class. I am not sure it will work fine with OnInitDialog.
  • Check your program /DLL is UNICODE code or not from the project settings.
  • By default Visual Studio 2008 will generate manifest for the program (for EXEs).
  • Manifest must be embedded only if the application is UNICODE.

Please check this.

执着的年纪 2024-11-21 09:47:53

我遇到了同样的问题,并通过谷歌引导到这里,但没有一个答案解决了问题。然后我仅通过将窗口/控件的 transparent 属性更改为 FALSE 来修复它。你能尝试一下吗?

I got the same problem and led down here by google, but none of the answers solved the problem. Then I fixed it only by changing the transparent attribute of the window/controls to FALSE. Can you try it out?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文