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.