From 516b479c0cbec19b1724630046f133dd5bfb1e70 Mon Sep 17 00:00:00 2001 From: Paul Larsen Date: Mon, 26 Aug 2024 10:00:31 -0400 Subject: [PATCH] B2024-060-Adding-a-picture-PROMS-crashes --- PROMS/Volian.Controls.Library/DisplayTags.cs | 2 +- PROMS/Volian.Controls.Library/ImageItem.cs | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/PROMS/Volian.Controls.Library/DisplayTags.cs b/PROMS/Volian.Controls.Library/DisplayTags.cs index 1362cac9..cb822689 100644 --- a/PROMS/Volian.Controls.Library/DisplayTags.cs +++ b/PROMS/Volian.Controls.Library/DisplayTags.cs @@ -103,7 +103,7 @@ namespace Volian.Controls.Library public string TbFSwd { get {return tbFSWd.Text;} - set { tbFSWd.Text = value; tbFSWd.Refresh(); trBarFS.Value = Convert.ToInt32(value); } + set { tbFSWd.Text = value; tbFSWd.Refresh(); } // trBarFS.Value = Convert.ToInt32(value); } public string TbFSht diff --git a/PROMS/Volian.Controls.Library/ImageItem.cs b/PROMS/Volian.Controls.Library/ImageItem.cs index 0c0dc085..f5eda541 100644 --- a/PROMS/Volian.Controls.Library/ImageItem.cs +++ b/PROMS/Volian.Controls.Library/ImageItem.cs @@ -317,9 +317,13 @@ namespace Volian.Controls.Library } private void SetWidthsAndHeights(System.Drawing.Image img) { - int wd = adjustimage(img.Width); // * MyStepPanel.DPI / 72; // converts from screen resolution's DPI to image's points (72/inch) - double ht = (double)wd * aspectratio(img.Width, img.Height); + int wd = img.Width * MyStepPanel.DPI / 72; // converts from screen resolution's DPI to image's points (72/inch) + int ht = img.Height * MyStepPanel.DPI / 72; + + //int wd = adjustimage(img.Width); // * MyStepPanel.DPI / 72; // converts from screen resolution's DPI to image's points (72/inch) + + //double ht = (double)wd * aspectratio(img.Width, img.Height); //int ht = adjustimage(img.Height); // * MyStepPanel.DPI / 72; if (MyItemInfo.MyContent.MyImage != null) // image is null if creating new. @@ -327,8 +331,10 @@ namespace Volian.Controls.Library ImageConfig ic = new ImageConfig(MyItemInfo.MyContent.MyImage); if (!_pastedNew && ic != null && ic.Image_Height != 0) { - wd = adjustimage(ic.Image_Width); // * MyStepPanel.DPI / 72; - ht = (double)wd * aspectratio(img.Width, img.Height); + wd = ic.Image_Width * MyStepPanel.DPI / 72; + ht = ic.Image_Height * MyStepPanel.DPI / 72; + //wd = adjustimage(ic.Image_Width); // * MyStepPanel.DPI / 72; + //ht = (double)wd * aspectratio(img.Width, img.Height); //ht = wd * (int)aspectratio(img.Width, img.Height); //ht = adjustimage(ic.Image_Height); // * MyStepPanel.DPI / 72; }