Commit 23b1e36c LN

bug修改

1 个父辈 32f60895
...@@ -439,9 +439,27 @@ namespace TSA_V ...@@ -439,9 +439,27 @@ namespace TSA_V
{ {
string[] files = openFileDialogImg.FileNames; string[] files = openFileDialogImg.FileNames;
List<string> fileTypes = new List<string>() { ".bmp", ".jpg", ".gif", ".png", ".jpeg" };
string defPath = Path.GetPathRoot(Application.StartupPath) + @"image\";
FrmNImageViewer imageViewer; FrmNImageViewer imageViewer;
bool findOK=false;
foreach (string file in files)
{
string ext = Path.GetExtension(file);
if (fileTypes.Contains(ext.ToLower()))
{
imageViewer = new FrmNImageViewer(openFileDialogImg.FileName);
if (!imageViewer.ShowDialog().Equals(DialogResult.Cancel))
{
openFileDialogImg.Tag = true;
this.txtImagePath.Text = openFileDialogImg.FileName;
return;
}
Setting_NInit.Data_LastOpenImagePath = Path.GetDirectoryName(file);
findOK = true;
return;
}
}
string defPath = Path.GetPathRoot(Application.StartupPath) + @"image\";
//List<string> newFiles = FileUtil.FileProcess(openFileDialog.FileNames); //List<string> newFiles = FileUtil.FileProcess(openFileDialog.FileNames);
GerberVS.BoundingBox boxBound = GerberVS.AGerberController.OpenLayers(files, defPath, out string filename); GerberVS.BoundingBox boxBound = GerberVS.AGerberController.OpenLayers(files, defPath, out string filename);
if (boxBound != null && File.Exists(filename)) if (boxBound != null && File.Exists(filename))
...@@ -477,7 +495,7 @@ namespace TSA_V ...@@ -477,7 +495,7 @@ namespace TSA_V
} }
else else
{ {
List<string> fileTypes = new List<string>() { ".bmp", ".jpg", ".gif", ".png", ".jpeg" }; //List<string> fileTypes = new List<string>() { ".bmp", ".jpg", ".gif", ".png", ".jpeg" };
foreach (string file in files) foreach (string file in files)
{ {
string ext = Path.GetExtension(file); string ext = Path.GetExtension(file);
......
...@@ -1597,10 +1597,18 @@ namespace TSA_V ...@@ -1597,10 +1597,18 @@ namespace TSA_V
updateBoardInfo.PointColor = color; updateBoardInfo.PointColor = color;
for (int i = 0; i < updateBoardInfo.smtList.Count; i++) for (int i = 0; i < updateBoardInfo.smtList.Count; i++)
{ {
if (dgvList.Rows.Count > i)
{
dgvList.Rows[i].Cells[this.Column_NodeX.Name].Value = updateBoardInfo.smtList[i].NodePositionX; dgvList.Rows[i].Cells[this.Column_NodeX.Name].Value = updateBoardInfo.smtList[i].NodePositionX;
dgvList.Rows[i].Cells[this.Column_NodeY.Name].Value = updateBoardInfo.smtList[i].NodePositionY; dgvList.Rows[i].Cells[this.Column_NodeY.Name].Value = updateBoardInfo.smtList[i].NodePositionY;
dgvList.Rows[i].Cells[this.Column_PointSizeX.Name].Value = updateBoardInfo.smtList[i].PointSizeX; dgvList.Rows[i].Cells[this.Column_PointSizeX.Name].Value = updateBoardInfo.smtList[i].PointSizeX;
dgvList.Rows[i].Cells[this.Column_PointSizeY.Name].Value = updateBoardInfo.smtList[i].PointSizeY; dgvList.Rows[i].Cells[this.Column_PointSizeY.Name].Value = updateBoardInfo.smtList[i].PointSizeY;
}
else
{
LogUtil.error("btnCalibrate_Click 未找到dgvList.Rows.Count > " + i + "的数据");
}
} }
SetListCurrCell(index); SetListCurrCell(index);
......
...@@ -30,8 +30,23 @@ namespace TSA_V ...@@ -30,8 +30,23 @@ namespace TSA_V
public bool IsWorkForm = false; public bool IsWorkForm = false;
public void SetImage(Image image) public void SetImage(Image image)
{ {
try
{
// 新增:确保在UI线程操作控件
if (picBoard?.InvokeRequired ?? false)
{
picBoard.Invoke(new Action<Image>(SetImage), image);
return;
}
picBoard.Image = image; picBoard.Image = image;
this.PicImage = image; this.PicImage = image;
}
catch (Exception ex)
{
LogUtil.error("PointDisplay SetImage error:" + ex.ToString());
}
} }
public void SetPic(PictureBox p, Panel pan) public void SetPic(PictureBox p, Panel pan)
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!