[译]超级ImageList和ToolBar生成器
By robot-v1.0
本文链接 https://www.kyfws.com/applications/super-imagelist-and-toolbar-generator-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 5 分钟阅读 - 2268 个词 阅读量 0[译]超级ImageList和ToolBar生成器
原文地址:https://www.codeproject.com/Articles/6067/Super-ImageList-and-ToolBar-generator
原文作者:TomKat
译文由本站 robot-v1.0 翻译
前言
A drag & drop ImageList and ToolBar generator . Simplifies creation of large image lists and supports effects .
拖放ImageList和ToolBar生成器.简化了大型图像列表的创建并支持效果.
- 下载源文件+插件-121 Kb(Download source files + Plugin - 121 Kb)
- 下载与此工具集成的源文件-27 Kb(Download source files that integrate with this tool - 27 Kb)
- 下载演示项目-163 Kb(Download demo project - 163 Kb)
- 下载一个小gif集合-340 Kb(Download a small gif collection - 340 Kb)
请注意(Please Note)
如果您喜欢这个并且觉得有用,应该(If you like this and find it usefull you should)评分(rate it).这是我唯一的满足感. ;)10倍(. It`s my only satisfaction for writing this. ;) 10x)
介绍(Introduction)
这个是来做什么的?我为什么要使用这个软件.(What is this for? Why should I use this software.)
非常简单:您必须使用树形控件构建应用程序,并且分支需要图像.您必须使用所有它们创建一个位图,然后创建图像列表,设置透明色等.(It’s quite simple: you have to build an application with a tree control and you need images for the branches. You have to create a bitmap with all of them and then create the image list, set transparency color, etc.)
如果您要使用100 GIF,则问题很大.该程序可以在2-3秒内生成100个gif的位图.它还会生成资源脚本,并定义是否要将其用作工具栏,并提供代码以将该位图集成到图像列表中.(If you have 100 gifs you want to use the problem is big. This program can generate a bitmap with 100 gifs in 2-3 seconds. It also generates the resource script and defines if you want to use this as a toolbar and provides code to integrate this bitmap to a image list.)
您可以向图像添加3种效果:变亮,变暗和灰度.它还支持一个插件框架,用于在生成图像之前对图像进行自定义处理.因此,使用此工具将在几分钟内准备好工具栏.(You can add 3 effects to the images: Lighten, Darken and Grayscale . It also supports a plug-in framework for your own custom processing of the image before generation. So , using this a toolbar is ready in a few minutes.)
如果图像较小,则可以设置工具栏按钮的大小,然后可以分配一些对齐设置.(If images are smaller then the toolbar button size you set then you can assign some alignment settings.)
整个UI都有提示,因此使用起来非常容易.帮助部分已填写,因此您可以阅读该软件功能的更详细说明.(The entire UI has tips so using it will be rather easy. The help section is filled-in so you can read a more detailed description of the functionality and functions of this software.)
它与(It provides a great integration with the) CTrueColorToolbar
类.因此,这旨在使我们这些与图像列表作斗争的人的生活更加轻松.(class. So , this is intended to make the lives of those of us fighting with image lists easier.)
为了进一步处理图像,您可以集成(For further image processing you can integrate the) CxImage
尽管集成非常简单,但是我没有发现这绝对重要.(library but I did not find this absolutely vital, although integration is very simple.)
怎么运行的(How it Works)
您必须设置将在其中生成文件的根目录,然后:(You have to set the root directory where the files will be generated and then:)
- 添加图像(add images)
- 设置按钮大小(set button sizes)
- 设置效果(如果需要)(set effects (if required))
- 设置对齐方式(如果需要)(set alignment (if required))
- 然后按生成.(and press generate .)
该文件还将"吐"(The file will also “spit” a)**.html(.html)**包含所有图像的文件(file containing all the images with the) src="original image"
)和() and the)
alt="Toolbar Button ID
, Index"
即使这可能不是最简单的解决方案,也可能是最接近的解决方案.(Even if this might not be the most simple solution it`s the closest thing available.)
将图像转换为源代码(Convert Image to Source Code)
我添加了另一个功能.它将位图生成为数组,并使您可以使用该位图而不需要位图资源.(I added another function. It generates the Bitmap as an array and gives you the possibility to use that bitmap without requiring a bitmap resource.)
//The Acrobat Reader icon .
DWORD ImageBits [16][16]={
{0xd4d0c8,0xd4d0c8,0xd4d0c8,0xd4d0c8,0xd4d0c8,0xd4d0c8,0xd4d0c8,0xd4d0c8,
0xf76b6b,0xde7b7b,0xd4d0c8,0xd4d0c8,0xd4d0c8,0xd4d0c8,0xd4d0c8,0xd4d0c8},
{0xd4d0c8,0xd4d0c8,0xd4d0c8,0xd4d0c8,0xd4d0c8,0xd4d0c8,0xd4d0c8,0xef8484,
0xff9c9c,0xbd6363,0xd4d0c8,0xd4d0c8,0xd4d0c8,0xd4d0c8,0xd4d0c8,0xd4d0c8},
{0xd4d0c8,0xc66b63,0xc66b63,0xc66b63,0xc66b63,0xc66b63,0xc66b63,0xff8c9c,
0xd63942,0xce5a5a,0xc66b63,0xc66b63,0xc66b63,0xd4d0c8,0xd4d0c8,0xd4d0c8},
{0xde4263,0xb56b73,0xad738c,0xad7b8c,0xc68494,0xce8c9c,0xce9cad,0xceadad,
0xe7737b,0xe79494,0xd6adad,0xcea5ad,0xe7848c,0xc65252,0xd4d0c8,0xd4d0c8},
{0xde4263,0xad8484,0x9c9c9c,0xadadad,0xc6c6c6,0xd6d6d6,0xdedede,0xefefef,
0xef8484,0xe79494,0xf7f7f7,0xefefef,0xefc6c6,0xc6636b,0xd4d0c8,0xd4d0c8},
{0xde425a,0xad8484,0xa5a5a5,0xbdbdbd,0xd6d6d6,0xdedede,0xefefef,0xffe7e7,
0xe76b6b,0xf77b7b,0xfff7f7,0xffffff,0xf7ced6,0xc66b73,0xd4d0c8,0xd4d0c8},
{0xde4242,0xb58c8c,0xadadad,0xc6c6c6,0xd6d6d6,0xe7e7e7,0xefefef,0xf79c9c,
0xe7adad,0xffd6d6,0xef8484,0xfff7f7,0xffe7e7,0xc68484,0xd4d0c8,0xd4d0c8},
{0xde4242,0xb58c8c,0xadadad,0xc6c6c6,0xd6d6d6,0xe7e7e7,0xf7efef,0xe76b6b,
0xf7f7f7,0xffe7e7,0xf79494,0xf74242,0xff6363,0xd65252,0xe76363,0xffb5b5},
{0xde4242,0xc69c9c,0xbdbdbd,0xc6c6c6,0xcecece,0xdedede,0xef9c9c,0xe79494,
0xe79494,0xe79494,0xe79494,0xe79494,0xe79494,0xd66b6b,0xd66363,0xad3939},
{0xde4242,0xcea5a5,0xc6c6c6,0xcecece,0xcec6c6,0xe79494,0xd66b6b,0xe7e7e7,
0xf7f7f7,0xffffff,0xf7f7f7,0xefefef,0xf7ced6,0xc68484,0xceadad,0xefe7e7},
{0xde4242,0xd6adad,0xcecece,0xd6bdbd,0xd67373,0xd6525a,0xc6c6c6,0xdedede,
0xe7e7e7,0xefefef,0xe7e7e7,0xdedede,0xe7bdbd,0xc66b63,0xd4d0c8,0xd4d0c8},
{0xde3142,0xe7bdbd,0xdedede,0xd68484,0xce5a5a,0xbd9c9c,0xcecece,0xcecece,
0xd6d6d6,0xd6d6d6,0xd6d6d6,0xcecece,0xd6b5b5,0xbd6363,0xd4d0c8,0xd4d0c8},
{0xde2939,0xe7bdbd,0xe7e7e7,0xd6d6d6,0xc6c6c6,0xcecece,0xcecece,0xc6c6c6,
0xc6c6c6,0xc6c6c6,0xc6c6c6,0xbdbdbd,0xc6a5a5,0xb55252,0xd4d0c8,0xd4d0c8},
{0xd62129,0xefc6c6,0xf7f7f7,0xe7e7e7,0xdedede,0xcecece,0xcecece,0xbdbdbd,
0xbdbdbd,0xb5b5b5,0xadadad,0xadadad,0xbd9494,0xb55252,0xd4d0c8,0xd4d0c8},
{0xde2139,0xff6b7b,0xff8c9c,0xff8c8c,0xe77394,0xd66b8c,0xce638c,0xc66384,
0xc65a73,0xc65a6b,0xc6636b,0xc66b6b,0xc65a6b,0xb54252,0xd4d0c8,0xd4d0c8},
{0xd4d0c8,0x8c1829,0x8c2929,0x7b2929,0x731829,0x731829,0x731829,0x731829,
0x731829,0x731829,0x731829,0x732929,0x732929,0xd4d0c8,0xd4d0c8,0xd4d0c8}
};
//Below is the code 4U2 use 2 show it on CDC named destinationDC
CBitmap hBitmap;
CDC hdcCompatible;
hdcCompatible.CreateCompatibleDC(&destinationDC);
if(hBitmap.CreateBitmap(16,16,1,sizeof(RGBQUAD)*8,&ImageBits))
{
hdcCompatible.SelectObject(&hBitmap);
destinationDC.BitBlt(0,0,16,16,&hdcCompatible,0,0,SRCCOPY);
hBitmap.DeleteObject();
hdcCompatible.DeleteDC();
}
外挂程式(Plug-ins)
您可以添加由您自己构建的插件来进一步处理图像.这会将图像转换为海军蓝色阴影.一个插件导出这两个功能:(You can add a plug-in built by you to further process the images. This transforms the images in shades of navy-blue. A plug-in exports these 2 functions:)
void APIENTRY ProcessPixels(RGBX* Pixels,RECT Rect,UINT BWidth,UINT BHeight);
void APIENTRY ProcessHDC(HDC DC,RECT Rect,UINT BWidth,UINT BHeight);
例子(Examples)
背景(Background)
本文利用(This article makes use of) CPicture
可在CodeProject上找到,以及(available here on CodeProject, and) CTrueColorToolbar
.对于界面,它已经集成了(. For the interface it has integrated the) CoolControlsManager
和我的(and my) ToolTipCtrlEx
.要添加图像文件,只需从Windows资源管理器中拖放它们即可.如果图像兼容,则会添加图像并显示一些信息.(. To add image files you simply drag & drop them from Windows Explorer. If images are compatible they are added and some information on them is displayed.)
历史(History)
-
2003年11月11日:首次发布.(11.02.2003: First release .)
-
2003年11月11日:(11.02.2003:)添加了新功能:将图像转换为源代码.(Added new function : Convert Image To Source Code .)
-
2003年2月12日:(12.02.2003:)
- 用过的(Used)**.dan.g."(.dan.g.')**来自他的代码的建议和启发,现在像素处理变得越来越快.由于性能的原因,进度条没有显示按像素进行编辑的进度(无论如何,它花费不到一秒钟的时间).(s sugestion and inspired from his code and now the pixel processing is lightening fast. The progress bar doesn`t show the progress of by pixel editing because of perfomance (anyway it takes less than a second).)
- 修复了一些错误(Fixed a few BUGS)
- 内部使用(作为演示)(Used it internally (as demo))
- VC6中提供的项目(Provided projects in VC6)
-
21.04.2004:为图像添加了自定义背景色(21.04.2004 : Added custom background color for images) 如果您喜欢这篇文章并觉得有用,请(If you like this article and find it usefull, please)率(rate)它(it).也许我会进一步发展它,提供一些可视化的编辑模式.但是,如果您了解它的工作原理,那么此功能是完美的.(. Maybe I’ll develop it a little further, providing some visual editing mode. But this functionality is perfect if you get how it works.)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
VC7.0 C++ VC6 WinXP Win2003 Windows Win2K MFC Visual-Studio Dev 新闻 翻译