7
votes

I'm trying to write a custom WiX dialog which, as part of its workflow, shows an error image in response to certain conditions. However, WiX appears to be ignoring my dimensions and displaying as it feels fit. Here's my code:

<Binary Id="WixUI_FailureImg" SourceFile="$(sys.SOURCEFILEDIR)..\Resources\Failure.ico" />
<Control Id="TestResult_Failure" Type="Icon" IconSize="16" X="15" Y="206" Width="16" Height="16" Text="WixUI_FailureImg">
    <Condition Action="hide">LOGON_VALID = "1"</Condition>
    <Condition Action="show">LOGON_VALID = "0"</Condition>
</Control>

I've included a snippet of the resulting dialog below, with the original image (a 16x16 .ico) in the background. As you can see, the image has been scaled upwards, and there is no transparency around the image. I've tried 8-bit and 24-bit bitmaps as well icons, but they all produce the same result. Is there something that I am doing obviously wrong?

example of borked image

UPDATE:

In case you were wondering how the dynamic images works, here's the relevant section:

<Control Id="TestResult_Success" Type="Icon" IconSize="16" X="15" Y="210" Width="12" Height="12" Text="WixUI_SuccessImg">
    <Condition Action="hide">LOGON_VALID = "0"</Condition>
    <Condition Action="show">LOGON_VALID = "1"</Condition>
</Control>
<Control Id="TestPrompt_Success" Type="Text" X="35" Y="210" Width="322" Height="10" Text="!(loc.SqlSelectDlgConnectionValid)">
    <Condition Action="hide">LOGON_VALID = "0"</Condition>
    <Condition Action="show">LOGON_VALID = "1"</Condition>
</Control>
<Control Id="TestResult_Failure" Type="Icon" IconSize="16" X="15" Y="210" Width="12" Height="12" Text="WixUI_FailureImg">
    <Condition Action="hide">LOGON_VALID = "1"</Condition>
    <Condition Action="show">LOGON_VALID = "0"</Condition>
</Control>
<Control Id="TestPrompt_Failure" Type="Text" X="35" Y="210" Width="322" Height="10" Text="!(loc.SqlSelectDlgConnectionInvalid)">
    <Condition Action="hide">LOGON_VALID = "1"</Condition>
    <Condition Action="show">LOGON_VALID = "0"</Condition>
</Control>

As you can guess from the screenshot, the page is related to establishing a SQL connection; I have a custom action that creates a connection string based on the user's input, and attempts to validate it. If it's valid (LOGON_VALID = "1"), I get a tick image and some text to say everything is good, otherwise I get a warning icon and some text to warn the user. Of course, the Next button is also controlled by this value.

1
asking a separate question..curious to know..are you changing image dynamically? i mean the image will appear as per the condition? - Sunil Agarwal
Yes; so there is a TestResult_Success control which shows a green tick if LOGON_VALID = 1, and hides it if LOGON_VALID = 0. The images are the same size and at the same location. - David Keaveny
can you please share some code for dynamically updating the image? - Sunil Agarwal
I've updated the original question to show my solution. Not clever, but it works :-) - David Keaveny
thanks a lot...i tried this a lot but never got..i was missing 'Text="WixUI_FailureImg"' which i got from your code. :) - Sunil Agarwal

1 Answers

7
votes

X, Y, Width, and Height are in "installer units," not pixels. Converting installer units to pixels depends on the visual theme, font size, and DPI settings. Your best bet is to make it look good on default settings.