B2024-060-Adding-a-picture-PROMS-crashes

This commit is contained in:
Paul Larsen 2024-08-26 10:00:31 -04:00
parent c06744b3bb
commit 516b479c0c
2 changed files with 11 additions and 5 deletions

View File

@ -103,7 +103,7 @@ namespace Volian.Controls.Library
public string TbFSwd public string TbFSwd
{ {
get {return tbFSWd.Text;} 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 public string TbFSht

View File

@ -317,9 +317,13 @@ namespace Volian.Controls.Library
} }
private void SetWidthsAndHeights(System.Drawing.Image img) 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; //int ht = adjustimage(img.Height); // * MyStepPanel.DPI / 72;
if (MyItemInfo.MyContent.MyImage != null) // image is null if creating new. 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); ImageConfig ic = new ImageConfig(MyItemInfo.MyContent.MyImage);
if (!_pastedNew && ic != null && ic.Image_Height != 0) if (!_pastedNew && ic != null && ic.Image_Height != 0)
{ {
wd = adjustimage(ic.Image_Width); // * MyStepPanel.DPI / 72; wd = ic.Image_Width * MyStepPanel.DPI / 72;
ht = (double)wd * aspectratio(img.Width, img.Height); 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 = wd * (int)aspectratio(img.Width, img.Height);
//ht = adjustimage(ic.Image_Height); // * MyStepPanel.DPI / 72; //ht = adjustimage(ic.Image_Height); // * MyStepPanel.DPI / 72;
} }