[GcodePreview]Fix background on dark theme (#29837)

This commit is contained in:
Pedro Lamas
2023-11-14 15:34:04 +00:00
committed by GitHub
parent 89a87e6db4
commit 9d2f9bcff2
4 changed files with 54 additions and 1 deletions

View File

@@ -29,6 +29,14 @@ namespace Microsoft.PowerToys.PreviewHandler.Gcode
/// </summary>
private bool _infoBarAdded;
/// <summary>
/// Initializes a new instance of the <see cref="GcodePreviewHandlerControl"/> class.
/// </summary>
public GcodePreviewHandlerControl()
{
SetBackgroundColor(Settings.BackgroundColor);
}
/// <summary>
/// Start the preview on the Control.
/// </summary>
@@ -124,7 +132,7 @@ namespace Microsoft.PowerToys.PreviewHandler.Gcode
{
_pictureBox = new PictureBox();
_pictureBox.BackgroundImage = image;
_pictureBox.BackgroundImageLayout = ImageLayout.Center;
_pictureBox.BackgroundImageLayout = Width >= image.Width && Height >= image.Height ? ImageLayout.Center : ImageLayout.Zoom;
_pictureBox.Dock = DockStyle.Fill;
Controls.Add(_pictureBox);
}