Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ManagedUI] backgroup image dimensions #109

Closed
JeremyAnsel opened this issue Jul 22, 2017 · 2 comments
Closed

[ManagedUI] backgroup image dimensions #109

JeremyAnsel opened this issue Jul 22, 2017 · 2 comments

Comments

@JeremyAnsel
Copy link

JeremyAnsel commented Jul 22, 2017

The exception thrown when the backgroup image ratio is invalid is not helpfull.

ProjectValidator suggests a size of 492x312 which throws a ValidationException. The exception is thrown when width > height:

if (project is ManagedProject && !project.BackgroundImage.IsEmpty() && project.ValidateBackgroundImage)
{
bool invalidAspectRatio = false;
try
{
string imageFile = Utils.PathCombine(project.SourceBaseDir, project.BackgroundImage);
if (IO.File.Exists(imageFile))
{
var img = Bitmap.FromFile(imageFile);
if (img.Width > img.Height)
invalidAspectRatio = true;
}
}
catch { }
if (invalidAspectRatio)
throw new ValidationException(
"Project.BackgroundImage has incompatible (with ManagedUI default dialogs) aspect ratio. The expected ratio is close to 492x312. " +
"The background image in ManagedUI dialogs is left-docked at runtime and if it's too wide it can push away (to right) " +
"the all other UI elements. " +
"You can suppress image validation by setting Project.ValidateBackgroundImage to 'false'.");
}

It is suggested to use a size of 156x312 or 164x497:

float ratio = 156f / 312f; //matching default WiX dialog image
ratio = 164f / 497f; //found by experiment

It would be better if the validation exception indicates the size to use.

@oleg-shilo
Copy link
Owner

Done.

The error message indeed needed the change. Thank you for that.

Please note that "WelcomeDialog.scaling.cs#L50-L51" reference is not an active code but a non-compilable records of the experiments with MSI UI.

The actual most accurate ratio is dictated by the runtime size of the PictureBox of the WelcomeDialog that can be observed in the WinForm designer.

@JeremyAnsel
Copy link
Author

Thanks

oleg-shilo added a commit that referenced this issue Aug 2, 2017
----
* Issue #111: Display attribute & Reset link doesn't work in FeaturesDialog window
* Issue #107: ManagedBootstrapperApplication Payloads
* issue #108: [ManagedUI] feature checkbox can be unchecked when allowChange is false
* Issue #109: [ManagedUI] backgroup image dimensions
* Issue #103: Compiler.WixLocation, WixSharp.wix.bin and new csproj format in Visual Studio 2017
* Issue #99: Working with embedded WPF UI and MSI; Updated code sample.
* Issue #102: Update nuget package WixSharp.bin to include WIX (Windows Installer Xml) Toolset v3.11
* Migration of WiX Toolset from v3.10.3 (v3.10.3007.0) to v3.11.0 (v3.11.1701.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants