在“ Inno向导”页面中可以有一个图像按钮,而不是纯标题文字吗?
我要完成的工作是创建一个“开/关”图像按钮,以在运行Inno设置时静音/播放音乐。
谢谢!
在Inno Setup中不直接支持为按钮设置图像。
因此,您必须恢复为Win32 API。
function LoadImage(hInst: Integer; ImageName: string; ImageType: UINT; X, Y: Integer;
Flags: UINT): THandle;
external '[email protected] stdcall';
function ImageList_Add(ImageList: THandle; Image, Mask: THandle): Integer;
external '[email protected] stdcall';
function ImageList_Create(CX, CY: Integer; Flags: UINT; Initial, Grow: Integer): THandle;
external '[email protected] stdcall';
const
IMAGE_BITMAP = 0;
LR_LOADFROMFILE = $10;
ILC_COLOR32 = $20;
BCM_SETIMAGELIST = $1600 + $0002;
type
BUTTON_IMAGELIST = record
himl: THandle;
margin: TRect;
uAlign: UINT;
end;
function SendSetImageListMessage(
Wnd: THandle; Msg: Cardinal; WParam: Cardinal; var LParam: BUTTON_IMAGELIST): Cardinal;
external '[email protected] stdcall';
function InitializeSetup(): Boolean;
var
ImageList: THandle;
Image: THandle;
ButtonImageList: BUTTON_IMAGELIST;
begin
ImageList := ImageList_Create(16, 16, ILC_COLOR32, 1, 1);
Image := LoadImage(0, 'button.bmp', IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
ImageList_Add(ImageList, Image, 0);
ButtonImageList.himl := ImageList;
SendSetImageListMessage(
WizardForm.NextButton.Handle, BCM_SETIMAGELIST, 0, ButtonImageList);
end;
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句