602
社区成员
发帖
与我相关
我的任务
分享
#include <PngImage.hpp>
// 以下添加到Form类中
private: // User declarations
HANDLE hDll;
TPngImage *png;
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
hDll = LoadLibrary(TEXT("dll.dll"));
png = new TPngImage;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
FreeLibrary(hDll);
delete png;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
// 从Dll资源中直接装载PNG图片
png->LoadFromResourceName(int(hDll), String("CrnPNG1")); // CrnPNG2, CrnPNG3....
// 显示在Image中
Image1->Picture->Bitmap->Assign(png);
}