读书人

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

发布时间: 2012-05-27 05:42:30 作者: rapoo

请给个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;

读书人网 >C++ Builder

热点推荐