3

I'm having a similar problem to the one discussed in this question.

I have created a custom WiXUIBannerBmp image at the dimensions suggested in the above link (493px x 58px) but it looks terrible because it's still being scaled. The actual dimensions on my screen appear to be about 616px x 73px. 616 = 493 * 1.25 and 73 = 58 * 1.25 (approx). Guess what? In my display settings I'm scaling my screen by 125%.

Is anyone aware of ways to handle this problem? Can I, for example:

  • detect the resolution scale and supply different files for different scales?
  • set a "don't scale" flag on my image?
  • supply an image format that scales reliably i.e. not a bmp or jpg?
  • any other ideas?

Thanks very much

Update

The only reference I have found to this problem is this post on SourceForge but I cannot find the bug that Rob mentions in his reply. Does anyone know if one was raised and if it was acted upon?

Community
  • 1
  • 1
David Jones - iPushPull
  • 2,819
  • 1
  • 22
  • 24

1 Answers1

0

You can use a custom action to read the screen resolution and dynamically populate the image control, this way:

[CustomAction]
public static ActionResult GenInstallationReview(Session session)
{
    // Insert Control Bitmap in Control table (MSI database).
    Record record = session.Database.CreateRecord(12);
    record.SetString(1, "Dialog_Review"); // Dialog_
    record.SetString(2, "Bitmap_Background"); // Control
    record.SetString(3, "Bitmap"); // Type
    record.SetInteger(4, 0); // X
    record.SetInteger(5, 0); // Y
    record.SetInteger(6, 518); // Width
    record.SetInteger(7, 392); // Height
    record.SetInteger(8, 1); // Attributes
    record.SetString(9, ""); // Property
    record.SetString(10, "Binary_Background"); // Text
    record.SetString(11, ""); // Control_Next
    record.SetString(12, ""); // Help

    // Queries the Control table to check if the control was already created.
    List<string> resultList = new List<string>();
    resultList = (List<string>)session.Database.ExecuteStringQuery(
      "SELECT `Control` FROM `Control` WHERE `Control` = 'Bitmap_Background'");

    // Insert or update the table based on if the control was already created.
    if (resultList.Count < 1)
        session.Database.Execute(
          "INSERT INTO `Control` (`Dialog_`, `Control`, `Type`, `X`, `Y`, " +
          "`Width`, `Height`, `Attributes`, `Property`, `Text`, " + 
          "`Control_Next`, `Help`) " + 
          "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) TEMPORARY", record);
    else
        session.Database.Execute(
          "UPDATE `Control` SET `Dialog_`=?, `Control`=?, `Type`=?, `X`=?, " +
          "`Y`=?, `Width`=?, `Height`=?, `Attributes`=?, `Property`=?, " +
          "`Text`=?, `Control_Next`=?, `Help`=? WHERE " +
          "`Control`='Bitmap_Background'", record);

    return ActionResult.Success;
}

There are a caveat here, if the image fills the dialog (background image, for example), the z-order will be messed up. You'd need to make some adjustments:

  • Create all controls using the custom action; or
  • Change the Control_Next to make your dynamic control part of focus cycle (although not used) and update the Control_First in Dialog table to use it.
Marlos
  • 1,927
  • 2
  • 22
  • 44