CListCtrl 显示 Unicode 和多字节字符集的不同主题

编程入门 行业动态 更新时间:2024-10-10 05:24:02
本文介绍了CListCtrl 显示 Unicode 和多字节字符集的不同主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-27 15:12:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1157053.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多字   字符集   主题   CListCtrl   Unicode

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!