c++ - 是否可以将图像列表保存到文件中?
问题描述
我想知道是否可以创建一个 CImageList 对象并将其保存为文件,以便我可以在其他项目中使用它,如果可以,我该如何保存它?
谢谢。
解决方案
如操作图像列表中所述:
您可以通过调用Write成员函数将图像信息写入存档,并通过调用Read成员函数将其读回。
CArchive可以由任何流支持,包括文件流。CImageList::Write的文档提供了有关如何将图像列表序列化到磁盘的完整示例代码:
// Open the archive to store the image list in. CFile myFile(_T("myfile.data"), CFile::modeCreate | CFile::modeWrite); CArchive ar(&myFile, CArchive::store); // Store the image list in the archive. m_myImageList.Write(&ar);
推荐阅读
- node.js - 运行“npm install --save express”时出错
- python - 在带有循环的列表中附加字典 - 非常非常奇怪
- ios - 需要帮助从 firebase 打印数组值
- python - matplotlib中箭头的位置
- sqlite - Sqlite3 .recover 用?
- machine-learning - Gensim 的 FastText 的 get_sentence_vector 等价于什么?
- angular - 如何处理具有不同表单控件名称的可选输入
- python - 用于匹配两个子字符串之间任意数量的元素的 Python 正则表达式?
- c# - 从 ServiceNow Rest API 访问 C# 中的 JSON 密钥
- java - Kotlin/Java - 构造函数的属性参数的 Java 注释中不存在的引用编译