首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ Builder >

请给个TBitmap转HICON的代码,该如何解决

2012-05-27 
请给个TBitmap转HICON的代码谢谢[解决办法]TIcon* iconGraphics::TBitmap* bmp/* Create an icon and lo

请给个TBitmap转HICON的代码
谢谢

[解决办法]
TIcon* icon;
Graphics::TBitmap* bmp;
 
/* Create an icon and load it from file. */
icon = new TIcon();
icon->LoadFromFile("..\\test_icon.ico");
 
/* Create a bitmap from the loaded icon. */
bmp = new Graphics::TBitmap();
icon->AssignTo(bmp); // Equivalent to: Bmp.Assign(Icon)
 
/* Assign the bitmap to the image on the form. */
Image1->Picture->Assign(bmp);
 
/* Free the intermediary objects. */
delete icon;
delete bmp;

热点排行