创建:
打开新建工程,选择[DLL Wizard]
OK
再打开新建,选择Text
LOGIN1 BITMAP D:\Founder\HS\HS_Base\res\jpg\login.bmp
HOMEBACK BITMAP "D:\Founder\HS\HS_Base\res\jpg\login.bmp"
POPBACK BITMAP "D:\Founder\HS\HS_Base\res\jpg\login.bmp"
DLLBACK BITMAP "D:\Founder\HS\HS_Base\res\jpg\login.bmp"
LOGIN PNG "D:\Founder\HS\HS_Base\res\jpg\png.png"
LOGO1 JPEG D:\Founder\HS\HS_Base\res\jpg\zs.jpg
LOGO JPEG D:\Founder\HS\HS_Base\res\jpg\logo.jpg
WAIT GIF D:\Founder\HS\HS_Base\res\jpg\Wait.gif
别名 图片类型 图片地址 ,此处图片地址必须用绝对地址
调用
bmp格式
Var
gv_res:THandle;
Begin
gv_res := LoadLibrary(PChar('D:\Founder\HS\HS_Base\bin\client\dllRes.dll')); {载入 DLL}
img1.Picture.Bitmap.LoadFromResourceName(gv_res,'LOGIN1');
end;
jpeg格式
Var
Stream:TStream;
MyJpg:TJpegImage;
gv_res:THandle;
Begin
gv_res := LoadLibrary(PChar('D:\Founder\HS\HS_Base\bin\client\dllRes.dll')); {载入 DLL}
Stream:= TResourceStream.Create(gv_res,'LOGO', 'JPEG');
Try
MyJPG := TjpegImage.Create;
Try
MyJPG.LoadFromStream(stream);
img1.Picture.Assign(MyJPG);
Finally
MyJPG.Free;
end;
Finally
stream.Free;
end;
end;
png格式
Var
Stream:TStream;
MyPng:TPngImage;
gv_res:THandle;
Begin
gv_res := LoadLibrary(PChar('D:\Founder\HS\HS_Base\bin\client\dllRes.dll')); {载入 DLL}
Stream:= TResourceStream.Create(gv_res,'LOGIN', 'PNG');
Try
MyPng := TPngImage.Create;
Try
MyPng.LoadFromStream(stream);
img1.Picture.Assign(MyPng);
Finally
MyPng.Free;
end;
Finally
stream.Free;
end;
end;
gif格式
Var
Stream:TStream;
MyGif:TGIFImage;
gv_res:THandle;
Begin
gv_res := LoadLibrary(PChar('D:\Founder\HS\HS_Base\bin\client\dllRes.dll')); {载入 DLL}
Stream:= TResourceStream.Create(gv_res,'WAIT', 'GIF');
Try
MyGif := TGIFImage.Create;
Try
MyGif.LoadFromStream(stream);
img1.Picture.Assign(MyGif);
TGIFImage(img1.Picture.Graphic).AnimationSpeed := 100;
TGIFImage(img1.Picture.Graphic).Animate := True;
Finally
MyGif.Free;
end;
Finally
stream.Free;
end;
end;
TImgButton按钮
Var
Stream:TStream;
MyPng:TPngImage;
gv_res:THandle;
Begin
gv_res := LoadLibrary(PChar('D:\Founder\HS\HS_Base\bin\client\dllRes.dll')); {载入 DLL}
Stream:= TResourceStream.Create(gv_res,'ADD64', 'PNG');
Try
MyPng := TPngImage.Create;
Try
MyPng.LoadFromStream(stream);
ImgButton1.ImageNormal.Assign(MyPng);
ImgButton1.ImageDown.Assign(MyPng);
ImgButton1.ImageOver.Assign(MyPng);
ImgButton1.ImageDisabled.Assign(MyPng);
Finally
MyPng.Free;
end;
Finally
stream.Free;
end;
end;
delphi创建资源文件dll并且调用
最新推荐文章于 2023-01-30 11:20:38 发布