如何在WIX中的自定义对话框中添加超链接

问题描述

我想在WIx的自定义对话框中添加链接,但是目前我只能添加消息而不是超链接。从安装程序5.0及更高版本开始,我看到Internet支持链接添加,我的是“ Windows®Installer。V 5.0.18362.1”

我正在使用的Wiix是“ WiX Toolset v3.11

我的客户对话框

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Fragment>
    <UI Id="SetupDialogUI">
      <Dialog Id="MyNewDlg" Width="370" Height="270" Title="Waygate Technologies">
         
        <Control Id="background" Type="Bitmap" Text="bgPic" Width="370" Height="234"  X="0" Y="0" TabSkip="no" />

        <Control Id="introText"  Type="Text" X="130" Y="50" Width="350" Height="22" Transparent="yes" Text="{\WixUI_Font_Title}CUDA Toolkit Installation" />
        <Control Id="explanationText" X="130" Y="100" Nowrap="no" RightAligned="no" Transparent="yes" Type="Text" Width="250" Height="100" Text=**"Before installing please install dependencies**." />

        <Control Id="installButton" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Ok">
        <Publish Event="EndDialog" Value="Return">1</Publish>
        </Control>
        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />

      </Dialog>
    <InstallUISequence>
      <Show Dialog="MyNewDlg" Before="ExecuteAction" />
    </InstallUISequence>
    </UI>
  </Fragment>
</Wix>    

解决方法

您只需要一个“ Hyperlink”类型的控件元素,其中包含格式化的文本,就在这里。

<Control Id="Link1" Type="Hyperlink" X="135" Y="250" Width="220" Height="60" >
   <Text><![CDATA[<a href="http://www.google.com/">Click here!</a>]]></Text>
</Control>