How can I add an image to a custom WiX dialog?

巧了我就是萌 提交于 2019-12-09 14:29:16

问题


I have tried modifying the set of WixVariables in my Product.wxs like so:

<WixVariable Id="MainLogoBmp" Value="Resources/Images/weblabel.jpg" />
<WixVariable Id="WixUIBannerBmp" Value="Resources/Images/installer_banner.jpg" />

(The first part is what I tried, the one below it is an example of the stock variable that works)

...and then referencing the variable with !(wix.MainLogoBmp):

<Control Id="Bitmap"
         Type="Bitmap"
         X="0"
         Y="0"
         Width="258"
         Height="185"
         TabSkip="no"
         Text="!(wix.MainLogoBmp)" />

...but when I try to compile this I get the following error:

Error 17 ICE17: Bitmap: 'Resources/Images/weblabel.jpg' for Control: 'Bitmap' of Dialog: 'SimpleDlg' not found in Binary table

And yes the image is part of the project, set to "Content" like the other ones.


回答1:


Aha, turns out I needed to add a Binary element to the file:

<Binary Id="MainImage" SourceFile="Resources/Images/weblabel.jpg" />

...and to set the Text of the Bitmap Control to "MainImage":

            <Control Id="Bitmap"
                        Type="Bitmap"
                        X="0"
                        Y="0"
                        Width="258"
                        Height="185"
                        TabSkip="no"
                        Text="MainImage" />

and now it works. :)



来源:https://stackoverflow.com/questions/3277809/how-can-i-add-an-image-to-a-custom-wix-dialog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!