CListCtrl 显示 Unicode 和多字节字符集的不同主题 [英] CListCtrl is showing different theme for Unicode and Multi byte character set

查看:34
本文介绍了CListCtrl 显示 Unicode 和多字节字符集的不同主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

List Control 主题在更改字符集时显示不同的主题:

List Control theme is showing different theme while changing the character set:

代码片段,

private:
CListCtrl m_list;

m_list.SetExtendedStyle(LVS_EX_GRIDLINES);
// TODO: Add extra initialization here

// Ask Mfc to create/insert a column
m_list.InsertColumn(
    0,              // Rank/order of item
    L"Name",         // Caption for this header
    LVCFMT_LEFT,    // Relative position of items under header
    100);          // Width of items under header

m_list.InsertColumn(1, L"Profession", LVCFMT_CENTER, 80);
m_list.InsertColumn(2, L"Fav. Sport", LVCFMT_LEFT, 100);
m_list.InsertColumn(3, L"Hobby", LVCFMT_LEFT, 80);

int nItem;

nItem = m_list.InsertItem(0, L"Sandra C. Anschwitz");
m_list.SetItemText(nItem, 1, L"Singer");
m_list.SetItemText(nItem, 2, L"HandBall");
m_list.SetItemText(nItem, 3, L"Beach");

nItem = m_list.InsertItem(0, L"Roger A. Miller");
m_list.SetItemText(nItem, 1, L"FootBaller");
m_list.SetItemText(nItem, 2, L"Tennis");
m_list.SetItemText(nItem, 3, L"Teaching");

如何获取多字节字符集中的 Unicode 主题?

How to get the Unicode theme in Multi Byte character set?

推荐答案

如果您使用 Visual C++ 中的应用程序向导生成此项目,则您的 stdafx.h 文件中可能包含以下几行:

If you generated this project using an app wizard in Visual C++, you probably have these lines in your stdafx.h file:

#ifdef _UNICODE
#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_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
#endif

这就是您的主题不同的原因.有技术原因在您的 MBCS 中不使用 Common Controls 6应用.但是,如果您可以成功地为 UNICODE 构建,那就这样做吧.任何受支持的 Windows 操作系统都支持 UNICODE,无论如何您都应该使用它.对 MBCS 说不.

This is the reason you are themed differently. There are technical reasons to not use Common Controls 6 in your MBCS application. However, if you can build for UNICODE successfully, just do that. Any supported Windows OS is UNICODE capable and that is what you should be using anyways. Just say NO to MBCS.

这篇关于CListCtrl 显示 Unicode 和多字节字符集的不同主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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