Commit 659eab71 LN

元器件可增加图片,导出程序时带图片导出。

1 个父辈 e4c3b1e4
......@@ -97,7 +97,9 @@ namespace TSA_V.Common
[MyConfigComment("是否启用元器件计数功能")]
public static MyConfig<bool> Device_UsePNCount = true;
[MyConfigComment("位号是否可以修改")]
public static MyConfig<bool> Device_CanModifyTagNo = false ;
public static MyConfig<bool> Device_CanModifyTagNo = false;
[MyConfigComment("元器件图片路径")]
public static MyConfig<string> Device_ComImagePath = @"\config\componentImage\";
[MyConfigComment("手势服务器端口")]
public static MyConfig<int> Hand_ServerPort = 8765;
[MyConfigComment("手势范围设置:x,y,w,h")]
......@@ -171,6 +173,8 @@ namespace TSA_V.Common
[MyConfigComment("最后一次校准信息,保存后作为新板子的基准")]
public static MyConfig<string> Data_LastCalibrateInfo ="";
[MyConfigComment("最后一次选择图片的目录")]
public static MyConfig<string> Data_LastOpenImagePath = "";
[MyConfigComment("RGB灯带端口号")]
......
......@@ -35,6 +35,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="AOI">
<HintPath>..\dll\AOI.dll</HintPath>
</Reference>
<Reference Include="Asa.IOModule.AIOBOX">
<HintPath>..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
</Reference>
......
......@@ -97,6 +97,8 @@ namespace TSA_V.DeviceLibrary
public Image myImage = null;
public List<ComponetInfo> componetList { get; set; } = null;
public string GetImgPath(bool isCheck = false)
{
string path = ConfigAppSettings.GetValue(Setting_Init.BOARD_IMAGE_PATH);
......@@ -109,7 +111,7 @@ namespace TSA_V.DeviceLibrary
}
else
{
imagePath = Application.StartupPath + @"\" + path + ConfigAppSettings.GetValue(Setting_Init.BOARD_IMAGE_DEFAULT);
imagePath = Application.StartupPath + @"/" + path + ConfigAppSettings.GetValue(Setting_Init.BOARD_IMAGE_PATH);
}
}
return imagePath;
......@@ -176,6 +178,8 @@ namespace TSA_V.DeviceLibrary
/// </summary>
public byte[] imageByte { get; set; }
public string imageBase64Data { get; set; }
public bool IsValid()
{
if (String.IsNullOrEmpty(boardName))
......
......@@ -401,7 +401,7 @@ namespace TSA_V.LoadCSVLibrary
}
public static bool UpdateComponet(string bomName, ComponetInfo com)
public static bool UpdateComponet(string bomName, ComponetInfo com,bool updateImage=false )
{
if (!allComMap.ContainsKey(bomName))
{
......@@ -413,9 +413,17 @@ namespace TSA_V.LoadCSVLibrary
if (oldList[index].IsSameCom(com))
{
oldList[index] = com;
break;
if (!updateImage)
{
break;
}
}else if (updateImage && oldList[index].PN.Equals(com.PN))
{
oldList[index].imgInfo = null;
}
}
if (SaveBomToFile(bomName, oldList))
{
......@@ -537,17 +545,31 @@ namespace TSA_V.LoadCSVLibrary
return false;
}
}
public static void RemoveBom(string bomName)
{
string fileName = getFilePath(bomName);
if (allComMap.ContainsKey(bomName))
{
try
{
allComMap.Remove(bomName);
string fileName = getFilePath(bomName);
if (allComMap.ContainsKey(bomName))
{
allComMap.Remove(bomName);
}
if (File.Exists(fileName))
{
File.Delete(fileName);
}
//删除图片文件夹
string filePath = Path.Combine(Setting_NInit.Device_ComImagePath, @"/" + bomName);
if (Directory.Exists(filePath))
{
Directory.Delete(filePath);
}
}
if (File.Exists(fileName))
{
File.Delete(fileName);
catch (Exception ex)
{
LogUtil.error("RemoveBom " + bomName + "出错:" + ex.ToString());
}
}
......@@ -809,6 +831,7 @@ namespace TSA_V.LoadCSVLibrary
for (int i = 0; i < list.Count; i++)
{
list[i].Id = i + 1;
list[i].SaveImage(bomName, null, list[i].ImgBase64Data);
}
CSVBomManager.AddBom(bomName, list);
......
using System;
using AOI;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TSA_V.Common;
using TSA_V.DeviceLibrary;
using TSA_V.LoadCSVLibrary;
......@@ -72,7 +75,80 @@ namespace TSA_V.LoadCSVLibrary
///投影文字
/// </summary>
[CSVAttribute("Text", "投影文字", false)]
public string Text { get; set; }
public string Text { get; set; }
///// <summary>
/////图片文件名
///// </summary>
//[CSVAttribute("ImageName", "图片文件名", false)]
//public string ImageName { get; set; } = "";
public string ImgBase64Data { get; set; } = "";
public Image imgInfo { get; set; } = null;
public Image GetImage(string bomName )
{
if (imgInfo == null)
{
string path =ImagePath(bomName);
if (File.Exists(path))
{
imgInfo = Eyemlib.DeepClone( Image.FromFile(path));
}
}
return imgInfo;
}
public bool SaveImage(string bomName, Image newImage, string base64Data = "")
{
try
{
string imagePath = ImagePath(bomName);
//ImageName = @"\" + bomName + @"\" + PN + ".bmp";
string path = Path.GetDirectoryName(imagePath);
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
if (File.Exists(imagePath))
{
File.Delete(imagePath);
}
if (newImage == null && base64Data != "")
{
ImageUtilM.Base64StringToFile(base64Data, imagePath);
imgInfo = null;
base64Data = "";
return true;
}
if (newImage == null)
{
//ImageName = "";
return false;
}
else
{
newImage.Save(imagePath);
imgInfo = null;
base64Data = "";
return true;
}
}
catch (Exception ex)
{
LogUtil.error("出错:" + ex.ToString());
}
return false;
}
public string ImagePath(string bomName )
{
string path = Application.StartupPath + Setting_NInit.Device_ComImagePath + @"\" + bomName + @"\" + PN + ".bmp"; ;
return path;
}
public int GetSortPosition()
{
......
......@@ -231,41 +231,49 @@ namespace TSA_V.DeviceLibrary
if (!CSVBomManager.BomNameIsExists(board.bomName))
{
List<ComponetInfo> componetInfos = new List<ComponetInfo>();
int i = 0;
foreach (SMTPointInfo p in board.smtList)
{
ComponetInfo c = new ComponetInfo();
if (p.componet != null)
if (board.componetList!=null&& board.componetList.Count > 0)
{
componetInfos = board.componetList;
}
else
{
int i = 0;
foreach (SMTPointInfo p in board.smtList)
{
c = p.componet;
if (p.PositionNum != c.PositionNum)
ComponetInfo c = new ComponetInfo();
if (p.componet != null)
{
LogUtil.error($"改导入程序【{board.boardName}】组装点【{p.TagNo + " " + p.PN}】的位置从【{p.PositionNum}】改为元器件库对应位置【{c.PositionNum}】 ");
p.PositionNum = c.PositionNum;
c = p.componet;
if (p.PositionNum != c.PositionNum)
{
LogUtil.error($"改导入程序【{board.boardName}】组装点【{p.TagNo + " " + p.PN}】的位置从【{p.PositionNum}】改为元器件库对应位置【{c.PositionNum}】 ");
p.PositionNum = c.PositionNum;
}
}
}
else
{
c.Id = i + 1;
c.PN = p.PN;
c.PositionNum =p.PositionNum;
c.PositionX = p.PositionX;
c.PositionY = p.PositionY;
c.TagNo = p.TagNo;
c.Notes = "";
c.Text =p.ShowText;
c.ComponentDes = "";
else
{
c.Id = i + 1;
c.PN = p.PN;
c.PositionNum = p.PositionNum;
c.PositionX = p.PositionX;
c.PositionY = p.PositionY;
c.TagNo = p.TagNo;
c.Notes = "";
c.Text = p.ShowText;
c.ComponentDes = "";
}
i++;
componetInfos.Add(c);
}
i++;
componetInfos.Add(c);
}
board.bomName = CSVBomManager.AutoAddBomList(board.bomName, componetInfos);
LogUtil.info("导入程序:程序名【" + board.boardName + "】,自动创建bom【"+board.bomName+"】");
}
board.componetList = null;
board.boardId = BoardManager.GetNextId();
BoardManager.Add(board);
......
......@@ -10,10 +10,10 @@ using TSA_V.Common;
namespace TSA_V.DeviceLibrary
{
public class ImageUtilM
public class ImageUtilM
{
private static string defPath = @"D:\image\";
private static string defPath = @"D:\image\";
public static bool canSavePic(string path = "", int checkZhao = 50)
{
......@@ -68,7 +68,7 @@ namespace TSA_V.DeviceLibrary
{
if (!canSavePic(path))
{
DeleteOldFiles(path, day);
DeleteOldFiles(path, day);
}
else
{
......@@ -115,7 +115,7 @@ namespace TSA_V.DeviceLibrary
string dire = @"D:\image\" + deviceName.Trim().Replace('_', '-') + @"\" + cameraName.Trim().Replace('_', '-').Replace(':', '-') + @"\";
string iamgeName = date + ".bmp";
try
{
{
if (AutoDelFiles(dire))
{
bitmap.Save(dire + iamgeName, ImageFormat.Bmp);
......@@ -129,5 +129,138 @@ namespace TSA_V.DeviceLibrary
}
return dire + iamgeName;
}
public static string BitMapToBase64(Image bitmap, int width = 0, int height = 0, int quality = 100)
{
try
{
if (bitmap == null) return "";
if (width == 0 || height == 0)
{
width = bitmap.Width;
height = bitmap.Height;
}
using (MemoryStream ms = new MemoryStream())
{
var tarbmp = ZoomImage(bitmap, height, width, quality);
tarbmp.Save(ms, ImageFormat.Jpeg);
byte[] bytes = ms.GetBuffer();
string base64 = Convert.ToBase64String(bytes);
// tarbmp.Save($".\\test_BitMapToBase64.bmp",ImageFormat.Jpeg);
//File.WriteAllText("E:\\Neotel\\Codes\\DLL\\IPCamera\\WindowsFormsApp1\\bin\\Debug\\test_BitMapToBase64.txt", base64);
//Base64ToBitmap(base64);
return base64;
}
}
catch (Exception e)
{
LogUtil.error("BitMapToStream: "+ e.ToString());
}
return "";
}
private static Image ZoomImage(Image bitmap, int destHeight, int destWidth, int quality = 100)
{
try
{
System.Drawing.Image sourImage = bitmap;
int width = 0, height = 0;
//按比例缩放
int sourWidth = sourImage.Width;
int sourHeight = sourImage.Height;
if (sourHeight > destHeight || sourWidth > destWidth)
{
if ((sourWidth * destHeight) > (sourHeight * destWidth))
{
width = destWidth;
height = (destWidth * sourHeight) / sourWidth;
}
else
{
height = destHeight;
width = (sourWidth * destHeight) / sourHeight;
}
}
else
{
width = sourWidth;
height = sourHeight;
}
Bitmap destBitmap = new Bitmap(destWidth, destHeight);
Graphics g = Graphics.FromImage(destBitmap);
g.Clear(Color.Transparent);
//设置画布的描绘质量
g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.DrawImage(sourImage, new Rectangle((destWidth - width) / 2, (destHeight - height) / 2, width, height), 0, 0, sourImage.Width, sourImage.Height, GraphicsUnit.Pixel);
//g.DrawImage(sourImage, new Rectangle(0, 0, destWidth, destHeight), new Rectangle(0, 0, sourImage.Width, sourImage.Height), GraphicsUnit.Pixel);
g.Dispose();
//设置压缩质量
System.Drawing.Imaging.EncoderParameters encoderParams = new System.Drawing.Imaging.EncoderParameters();
long[] qualitys = new long[1];
qualitys[0] = quality;
System.Drawing.Imaging.EncoderParameter encoderParam = new System.Drawing.Imaging.EncoderParameter(System.Drawing.Imaging.Encoder.Quality, qualitys);
encoderParams.Param[0] = encoderParam;
sourImage.Dispose();
return destBitmap;
}
catch (Exception ex)
{
return bitmap;
}
}
public static Bitmap Base64StringToImage(string inputStr)
{
try
{
if (inputStr == "")
{
return null;
}
byte[] arr = Convert.FromBase64String(inputStr);
//using (MemoryStream ms = new MemoryStream(arr))
{
MemoryStream ms = new MemoryStream(arr);
Bitmap bmp = new Bitmap(ms);
ms.Close();
return bmp;
}
}
catch (Exception ex)
{
LogUtil.error("Base64StringToImage 转换失败/nException:" + ex.ToString());
return null;
}
}
public static bool Base64StringToFile(string inputStr,string filePath)
{
try
{
if (inputStr == "")
{
return false ;
}
byte[] arr = Convert.FromBase64String(inputStr);
using (MemoryStream ms = new MemoryStream(arr))
{
using (Image image = Image.FromStream(ms))
{
image.Save(filePath, ImageFormat.Bmp); // 可根据实际需要保存为不同格式的图片
return true;
}
}
}
catch (Exception ex)
{
LogUtil.error("Base64StringToImage 转换失败/nException:" + ex.ToString());
return false ;
}
}
}
}
......@@ -28,7 +28,6 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmComponentList));
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnImport = new System.Windows.Forms.Button();
this.btnExport = new System.Windows.Forms.Button();
......@@ -38,6 +37,10 @@
this.label3 = new System.Windows.Forms.Label();
this.cmbList = new System.Windows.Forms.ComboBox();
this.groupInfo = new System.Windows.Forms.GroupBox();
this.txtImgName = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.picImage = new System.Windows.Forms.PictureBox();
this.lklSelImage = new System.Windows.Forms.LinkLabel();
this.txtLedIndex = new System.Windows.Forms.TextBox();
this.linkCloseAll = new System.Windows.Forms.LinkLabel();
this.linkOpenAll = new System.Windows.Forms.LinkLabel();
......@@ -60,9 +63,14 @@
this.label1 = new System.Windows.Forms.Label();
this.btnSave = new System.Windows.Forms.Button();
this.dgvList = new System.Windows.Forms.DataGridView();
this.btnBack = new System.Windows.Forms.Button();
this.btnNew = new System.Windows.Forms.Button();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.openFileDialogImg = new System.Windows.Forms.OpenFileDialog();
this.Column_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_partNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_PN = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_img = new System.Windows.Forms.DataGridViewImageColumn();
this.Column_Count = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_Position = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_Notes = new System.Windows.Forms.DataGridViewTextBoxColumn();
......@@ -70,11 +78,9 @@
this.Column_X = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_Y = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_Del = new System.Windows.Forms.DataGridViewLinkColumn();
this.btnBack = new System.Windows.Forms.Button();
this.btnNew = new System.Windows.Forms.Button();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.groupBox1.SuspendLayout();
this.groupInfo.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picImage)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dgvList)).BeginInit();
this.SuspendLayout();
//
......@@ -188,6 +194,10 @@
//
this.groupInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupInfo.Controls.Add(this.txtImgName);
this.groupInfo.Controls.Add(this.label8);
this.groupInfo.Controls.Add(this.picImage);
this.groupInfo.Controls.Add(this.lklSelImage);
this.groupInfo.Controls.Add(this.txtLedIndex);
this.groupInfo.Controls.Add(this.linkCloseAll);
this.groupInfo.Controls.Add(this.linkOpenAll);
......@@ -216,10 +226,51 @@
this.groupInfo.TabStop = false;
this.groupInfo.Text = "元器件基本信息";
//
// txtImgName
//
this.txtImgName.Enabled = false;
this.txtImgName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtImgName.Location = new System.Drawing.Point(263, 8);
this.txtImgName.MaxLength = 30;
this.txtImgName.Name = "txtImgName";
this.txtImgName.Size = new System.Drawing.Size(112, 29);
this.txtImgName.TabIndex = 309;
this.txtImgName.Visible = false;
//
// label8
//
this.label8.Location = new System.Drawing.Point(6, 153);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(114, 17);
this.label8.TabIndex = 308;
this.label8.Text = "图片:";
this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// picImage
//
this.picImage.Location = new System.Drawing.Point(126, 121);
this.picImage.Name = "picImage";
this.picImage.Size = new System.Drawing.Size(196, 116);
this.picImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picImage.TabIndex = 307;
this.picImage.TabStop = false;
this.picImage.DoubleClick += new System.EventHandler(this.picImage_DoubleClick);
//
// lklSelImage
//
this.lklSelImage.AutoSize = true;
this.lklSelImage.Location = new System.Drawing.Point(341, 153);
this.lklSelImage.Name = "lklSelImage";
this.lklSelImage.Size = new System.Drawing.Size(56, 17);
this.lklSelImage.TabIndex = 305;
this.lklSelImage.TabStop = true;
this.lklSelImage.Text = "选择文件";
this.lklSelImage.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lklSelImage_LinkClicked);
//
// txtLedIndex
//
this.txtLedIndex.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtLedIndex.Location = new System.Drawing.Point(246, 302);
this.txtLedIndex.Location = new System.Drawing.Point(246, 367);
this.txtLedIndex.MaxLength = 30;
this.txtLedIndex.Name = "txtLedIndex";
this.txtLedIndex.Size = new System.Drawing.Size(151, 29);
......@@ -228,7 +279,7 @@
// linkCloseAll
//
this.linkCloseAll.AutoSize = true;
this.linkCloseAll.Location = new System.Drawing.Point(85, 349);
this.linkCloseAll.Location = new System.Drawing.Point(85, 416);
this.linkCloseAll.Name = "linkCloseAll";
this.linkCloseAll.Size = new System.Drawing.Size(32, 17);
this.linkCloseAll.TabIndex = 82;
......@@ -240,7 +291,7 @@
// linkOpenAll
//
this.linkOpenAll.AutoSize = true;
this.linkOpenAll.Location = new System.Drawing.Point(23, 349);
this.linkOpenAll.Location = new System.Drawing.Point(23, 416);
this.linkOpenAll.Name = "linkOpenAll";
this.linkOpenAll.Size = new System.Drawing.Size(32, 17);
this.linkOpenAll.TabIndex = 81;
......@@ -252,7 +303,7 @@
// linkUpdate
//
this.linkUpdate.AutoSize = true;
this.linkUpdate.Location = new System.Drawing.Point(147, 349);
this.linkUpdate.Location = new System.Drawing.Point(147, 416);
this.linkUpdate.Name = "linkUpdate";
this.linkUpdate.Size = new System.Drawing.Size(56, 17);
this.linkUpdate.TabIndex = 80;
......@@ -264,7 +315,7 @@
// linkLabel2
//
this.linkLabel2.AutoSize = true;
this.linkLabel2.Location = new System.Drawing.Point(319, 349);
this.linkLabel2.Location = new System.Drawing.Point(319, 416);
this.linkLabel2.Name = "linkLabel2";
this.linkLabel2.Size = new System.Drawing.Size(56, 17);
this.linkLabel2.TabIndex = 79;
......@@ -276,7 +327,7 @@
// linkLabel1
//
this.linkLabel1.AutoSize = true;
this.linkLabel1.Location = new System.Drawing.Point(233, 349);
this.linkLabel1.Location = new System.Drawing.Point(233, 416);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(56, 17);
this.linkLabel1.TabIndex = 78;
......@@ -292,7 +343,7 @@
this.txtId.Location = new System.Drawing.Point(126, 8);
this.txtId.MaxLength = 30;
this.txtId.Name = "txtId";
this.txtId.Size = new System.Drawing.Size(271, 29);
this.txtId.Size = new System.Drawing.Size(112, 29);
this.txtId.TabIndex = 77;
this.txtId.Visible = false;
//
......@@ -300,7 +351,7 @@
//
this.btnNewCom.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnNewCom.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnNewCom.Location = new System.Drawing.Point(108, 393);
this.btnNewCom.Location = new System.Drawing.Point(108, 466);
this.btnNewCom.Name = "btnNewCom";
this.btnNewCom.Size = new System.Drawing.Size(130, 45);
this.btnNewCom.TabIndex = 76;
......@@ -315,9 +366,9 @@
this.cmbPositionNumList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbPositionNumList.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.cmbPositionNumList.FormattingEnabled = true;
this.cmbPositionNumList.Location = new System.Drawing.Point(126, 302);
this.cmbPositionNumList.Location = new System.Drawing.Point(126, 364);
this.cmbPositionNumList.Name = "cmbPositionNumList";
this.cmbPositionNumList.Size = new System.Drawing.Size(112, 27);
this.cmbPositionNumList.Size = new System.Drawing.Size(112, 33);
this.cmbPositionNumList.TabIndex = 75;
this.cmbPositionNumList.SelectedIndexChanged += new System.EventHandler(this.cmbPositionNumList_SelectedIndexChanged);
//
......@@ -342,7 +393,7 @@
//
// label6
//
this.label6.Location = new System.Drawing.Point(6, 308);
this.label6.Location = new System.Drawing.Point(6, 374);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(114, 17);
this.label6.TabIndex = 71;
......@@ -352,7 +403,7 @@
// txtCount
//
this.txtCount.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtCount.Location = new System.Drawing.Point(126, 257);
this.txtCount.Location = new System.Drawing.Point(126, 325);
this.txtCount.MaxLength = 30;
this.txtCount.Name = "txtCount";
this.txtCount.Size = new System.Drawing.Size(112, 29);
......@@ -360,7 +411,7 @@
//
// label5
//
this.label5.Location = new System.Drawing.Point(6, 264);
this.label5.Location = new System.Drawing.Point(6, 332);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(114, 17);
this.label5.TabIndex = 69;
......@@ -371,16 +422,16 @@
//
this.txtNotes.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtNotes.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtNotes.Location = new System.Drawing.Point(126, 195);
this.txtNotes.Location = new System.Drawing.Point(126, 286);
this.txtNotes.MaxLength = 30;
this.txtNotes.Multiline = true;
this.txtNotes.Name = "txtNotes";
this.txtNotes.Size = new System.Drawing.Size(271, 46);
this.txtNotes.Size = new System.Drawing.Size(271, 29);
this.txtNotes.TabIndex = 68;
//
// label4
//
this.label4.Location = new System.Drawing.Point(6, 201);
this.label4.Location = new System.Drawing.Point(6, 292);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(114, 17);
this.label4.TabIndex = 67;
......@@ -390,16 +441,16 @@
// txtDes
//
this.txtDes.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtDes.Location = new System.Drawing.Point(126, 133);
this.txtDes.Location = new System.Drawing.Point(126, 247);
this.txtDes.MaxLength = 30;
this.txtDes.Multiline = true;
this.txtDes.Name = "txtDes";
this.txtDes.Size = new System.Drawing.Size(271, 46);
this.txtDes.Size = new System.Drawing.Size(271, 29);
this.txtDes.TabIndex = 66;
//
// label2
//
this.label2.Location = new System.Drawing.Point(6, 138);
this.label2.Location = new System.Drawing.Point(6, 254);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(114, 17);
this.label2.TabIndex = 34;
......@@ -409,7 +460,7 @@
// txtName
//
this.txtName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtName.Location = new System.Drawing.Point(126, 88);
this.txtName.Location = new System.Drawing.Point(126, 82);
this.txtName.MaxLength = 30;
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(271, 29);
......@@ -417,18 +468,18 @@
//
// label1
//
this.label1.Location = new System.Drawing.Point(6, 95);
this.label1.Location = new System.Drawing.Point(6, 89);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(114, 17);
this.label1.TabIndex = 32;
this.label1.Text = "料盘位置:";
this.label1.Text = "物料编号:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// btnSave
//
this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnSave.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSave.Location = new System.Drawing.Point(246, 393);
this.btnSave.Location = new System.Drawing.Point(246, 466);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(130, 45);
this.btnSave.TabIndex = 4;
......@@ -448,6 +499,7 @@
this.Column_ID,
this.Column_partNumber,
this.Column_PN,
this.Column_img,
this.Column_Count,
this.Column_Position,
this.Column_Notes,
......@@ -467,6 +519,40 @@
this.dgvList.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvList_CellContentClick);
this.dgvList.SelectionChanged += new System.EventHandler(this.dgvList_SelectionChanged);
//
// btnBack
//
this.btnBack.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnBack.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBack.Location = new System.Drawing.Point(1120, 21);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(130, 45);
this.btnBack.TabIndex = 6;
this.btnBack.Text = "返回(&B)";
this.btnBack.UseVisualStyleBackColor = true;
this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
//
// btnNew
//
this.btnNew.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnNew.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnNew.Location = new System.Drawing.Point(981, 21);
this.btnNew.Name = "btnNew";
this.btnNew.Size = new System.Drawing.Size(130, 45);
this.btnNew.TabIndex = 3;
this.btnNew.Text = "上传元器件库";
this.btnNew.UseVisualStyleBackColor = true;
this.btnNew.Visible = false;
this.btnNew.Click += new System.EventHandler(this.btnNew_Click);
//
// openFileDialog1
//
this.openFileDialog1.FileName = "openFileDialog1";
//
// openFileDialogImg
//
this.openFileDialogImg.FileName = "openFileDialog2";
//
// Column_ID
//
this.Column_ID.HeaderText = "ID";
......@@ -488,6 +574,13 @@
this.Column_PN.Name = "Column_PN";
this.Column_PN.ReadOnly = true;
//
// Column_img
//
this.Column_img.HeaderText = "图片";
this.Column_img.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom;
this.Column_img.Name = "Column_img";
this.Column_img.ReadOnly = true;
//
// Column_Count
//
this.Column_Count.DataPropertyName = "ComCount";
......@@ -549,42 +642,12 @@
this.Column_Del.UseColumnTextForLinkValue = true;
this.Column_Del.Width = 70;
//
// btnBack
//
this.btnBack.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnBack.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBack.Location = new System.Drawing.Point(1120, 21);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(130, 45);
this.btnBack.TabIndex = 6;
this.btnBack.Text = "返回(&B)";
this.btnBack.UseVisualStyleBackColor = true;
this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
//
// btnNew
//
this.btnNew.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnNew.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnNew.Location = new System.Drawing.Point(981, 21);
this.btnNew.Name = "btnNew";
this.btnNew.Size = new System.Drawing.Size(130, 45);
this.btnNew.TabIndex = 3;
this.btnNew.Text = "上传元器件库";
this.btnNew.UseVisualStyleBackColor = true;
this.btnNew.Visible = false;
this.btnNew.Click += new System.EventHandler(this.btnNew_Click);
//
// openFileDialog1
//
this.openFileDialog1.FileName = "openFileDialog1";
//
// FrmComponentList
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1289, 729);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.groupBox1);
this.Name = "FrmComponentList";
this.Text = "元器件信息";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
......@@ -595,6 +658,7 @@
this.groupBox1.ResumeLayout(false);
this.groupInfo.ResumeLayout(false);
this.groupInfo.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picImage)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dgvList)).EndInit();
this.ResumeLayout(false);
......@@ -626,16 +690,6 @@
private System.Windows.Forms.Button btnDel;
private System.Windows.Forms.ComboBox cmbPositionNumList;
private System.Windows.Forms.Button btnNewCom;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_partNumber;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_PN;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_Count;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_Position;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_Notes;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_description;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_X;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_Y;
private System.Windows.Forms.DataGridViewLinkColumn Column_Del;
private System.Windows.Forms.TextBox txtId;
private System.Windows.Forms.LinkLabel linkLabel1;
private System.Windows.Forms.LinkLabel linkLabel2;
......@@ -646,5 +700,21 @@
private System.Windows.Forms.Button btnImport;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.TextBox txtLedIndex;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.PictureBox picImage;
private System.Windows.Forms.LinkLabel lklSelImage;
private System.Windows.Forms.OpenFileDialog openFileDialogImg;
private System.Windows.Forms.TextBox txtImgName;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_partNumber;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_PN;
private System.Windows.Forms.DataGridViewImageColumn Column_img;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_Count;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_Position;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_Notes;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_description;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_X;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_Y;
private System.Windows.Forms.DataGridViewLinkColumn Column_Del;
}
}
\ No newline at end of file
......@@ -13,6 +13,7 @@ using System.IO;
using TSA_V.LoadCSVLibrary;
using TSA_V.DeviceLibrary.manager;
using NPOI.SS.Formula.Functions;
using AOI;
namespace TSA_V
{
......@@ -34,6 +35,8 @@ namespace TSA_V
}
private void LanguagePro()
{
//this.Column_imgName.HeaderText = ResourceCulture.GetString(ResourceCulture.Column_imgName, "图片名称");
this.Column_img.HeaderText = ResourceCulture.GetString(ResourceCulture.Column_img, "图片");
this.Column_partNumber.HeaderText = ResourceCulture.GetString(ResourceCulture.Col_Num, "位号");
this.Column_PN.HeaderText = ResourceCulture.GetString(ResourceCulture.Col_Name, "物料编码");
this.Column_Count.HeaderText = ResourceCulture.GetString(ResourceCulture.Col_Count, "数量");
......@@ -45,6 +48,11 @@ namespace TSA_V
this.Column_Del.ToolTipText = ResourceCulture.GetString(ResourceCulture.ItemText_Delete, "删除");
}
private string CurrBomName()
{
return cmbList.Text;
}
private List<TSAVPosition> allPosition = new List<TSAVPosition>(CSVPositionReader<TSAVPosition>.allPositionMap.Values);
private void loadPositionList()
{
......@@ -93,12 +101,12 @@ namespace TSA_V
{
if (com != null)
{
dgvList.Rows.Add(SetRowInfo(null, com));
dgvList.Rows.Add(SetRowInfo(null, com,cmbList.Text));
}
}
}
private DataGridViewRow SetRowInfo(DataGridViewRow view, ComponetInfo com)
private DataGridViewRow SetRowInfo(DataGridViewRow view, ComponetInfo com,string bomName)
{
if (view == null)
{
......@@ -114,6 +122,9 @@ namespace TSA_V
view.Cells[this.Column_Position.Index].Value = com.PositionNum.ToString();
view.Cells[this.Column_Count.Index].Value = com.ComCount.ToString();
view.Cells[this.Column_ID.Index].Value = com.Id.ToString();
view.Cells[this.Column_img.Index].Value = com.GetImage(bomName);
//view.Cells[this.Column_imgName.Index].Value = com.ImageName(CurrBomName());
return view;
}
......@@ -232,7 +243,7 @@ namespace TSA_V
BoardManager.Update(board);
}
}
}
}
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.ComSaveOk, "元器件【{0}】保存成功!", addObj.TagNo + "-" + addObj.PN));
}
}
......@@ -305,16 +316,32 @@ namespace TSA_V
}
bool sureSave = ProcessComData(cmbList.Text, obj);
if(!sureSave)
if (!sureSave)
{
return;
}
bool result = CSVBomManager.UpdateComponet(cmbList.Text, obj);
bool updateImg = false;
//判断如果图片不为空,保存图片到指定位置
if (picImage.Image != null)
{
Image newImage = Eyemlib.DeepClone(picImage.Image);
updateImg= obj.SaveImage(cmbList.Text, newImage);
}
bool result = CSVBomManager.UpdateComponet(cmbList.Text, obj,updateImg);
if (result)
{
//ComponentManager.Update(obj);
SetRowInfo(dgvList.Rows[rowIndex], obj);
SetRowInfo(dgvList.Rows[rowIndex], obj,cmbList.Text);
if (updateImg)
{
foreach (DataGridViewRow objRow in dgvList.Rows)
{
if (objRow.Cells[Column_PN.Index].Value.ToString().Equals(obj.PN))
{
objRow.Cells[Column_img.Index].Value = obj.GetImage(CurrBomName());
}
}
}
MessageBox.Show(ResourceCulture.GetString(ResourceCulture.ComSaveOk, "元器件【{0}】保存成功!", obj.TagNo + "-" + obj.PN));
groupInfo.Text = ResourceCulture.GetString(ResourceCulture.ComInfo, "元器件【{0}】的基本信息", obj.TagNo + "-" + obj.PN);
}
......@@ -391,6 +418,14 @@ namespace TSA_V
return null;
}
//判断如果图片不为空,保存图片到指定位置
if (picImage.Image != null)
{
Image newImage = Eyemlib.DeepClone(picImage.Image);
obj.SaveImage(cmbList.Text, newImage);
}
List<ComponetInfo> list = CSVBomManager.AddCom(cmbList.Text, obj);
if (list == null)
{
......@@ -426,6 +461,7 @@ namespace TSA_V
{
return null;
}
point.Id = Convert.ToInt32(row.Cells[this.Column_ID.Name].Value.ToString());
point.TagNo = row.Cells[this.Column_partNumber.Name].Value.ToString();
point.PN = row.Cells[this.Column_PN.Name].Value.ToString();
point.PositionX = Convert.ToDouble(row.Cells[this.Column_X.Name].Value.ToString());
......@@ -434,7 +470,11 @@ namespace TSA_V
point.Notes = row.Cells[this.Column_Notes.Name].Value.ToString();
point.PositionNum = row.Cells[this.Column_Position.Name].Value.ToString();
point.ComCount = row.Cells[this.Column_Count.Name].Value.ToString();
point.Id = Convert.ToInt32(row.Cells[this.Column_ID.Name].Value.ToString());
//point.ImageName = row.Cells[this.Column_imgName.Name].Value.ToString();
if (row.Cells[this.Column_img.Name].Value != null)
{
point.imgInfo = (Image)row.Cells[this.Column_img.Name].Value;
}
}
catch (Exception ex)
......@@ -458,6 +498,7 @@ namespace TSA_V
txtPartNum.Enabled = true;
this.cmbPositionNumList.SelectedIndex = 0;
btnNewCom.Visible = false;
picImage.Image = null;
groupInfo.Text = ResourceCulture.GetString(ResourceCulture.NewCom, "新增元器件");
}
private ComponetInfo selCom = null;
......@@ -480,6 +521,7 @@ namespace TSA_V
txtCount.Text = obj.ComCount.ToString();
txtPartNum.Text = obj.TagNo;
txtNotes.Text = obj.Notes;
picImage.Image = obj.GetImage(cmbList.Text);
if (txtPartNum.Text == "")
{
txtPartNum.Enabled = true;
......@@ -704,25 +746,25 @@ namespace TSA_V
position = null;
return;
}
position = CSVPositionReader<TSAVPosition>.GetPositonByNum(pNum);
if (position != null && (position.IsLedLabel() ||position.IsRgbLed() ))
position = CSVPositionReader<TSAVPosition>.GetPositonByNum(pNum);
if (position != null && (position.IsLedLabel() || position.IsRgbLed()))
{
LinkVisible(true,position.PositionType );
LinkVisible(true, position.PositionType);
txtLedIndex.Text = position.Leds;
}
else
{
LinkVisible(false);
LinkVisible(false);
}
}
private void LinkVisible(bool show,int type=0)
private void LinkVisible(bool show, int type = 0)
{
linkLabel1.Visible = show;
linkLabel2.Visible = show;
linkCloseAll.Visible = show;
linkOpenAll.Visible = show;
linkUpdate.Visible = show&&type==2;
linkUpdate.Visible = show && type == 2;
txtLedIndex.Visible = show && type == 3;
}
private LabelInfo PreLabel = null;
......@@ -730,7 +772,7 @@ namespace TSA_V
{
if (PreLabel != null)
{
if ( pPnum!=""&& PreLabel.pos != pPnum)
if (pPnum != "" && PreLabel.pos != pPnum)
{
LedLabelController.CloseLed(PreLabel.ip, PreLabel.mac);
PreLabel = null;
......@@ -742,16 +784,16 @@ namespace TSA_V
{
if (position != null && position.IsRgbLed())
{
List<int> leds=position.getLedList(txtLedIndex.Text);
List<int> leds = position.getLedList(txtLedIndex.Text);
RgbLedController.OpenPosLed(leds);
}
else
{
{
string pNum = cmbPositionNumList.Text;
CloseLed(pNum);
//TSAVPosition position = CSVPositionReader<TSAVPosition>.GetPositonByNum(pNum);
if (position != null && position.IsLedLabel())
{
{
PreLabel = LedLabelController.GetLabel(position, selCom, true);
LedLabelController.OpenLed(position.DeviceIP, position.Leds);
//LedLabelController.UpdateScreen(PreLabel);
......@@ -783,7 +825,7 @@ namespace TSA_V
if (cmbList.Text != "" && cmbList.SelectedIndex >= 0)
{
try
{
{
string key = cmbList.Text;
List<ComponetInfo> list = CSVBomManager.GetComList(key);
......@@ -812,7 +854,7 @@ namespace TSA_V
{
MessageBox.Show(ex.ToString());
}
}
}
}
private string[] getLine(List<ComponetInfo> list)
{
......@@ -842,15 +884,15 @@ namespace TSA_V
return line.ToArray();
}
private Dictionary<string,string> getTitleMap()
private Dictionary<string, string> getTitleMap()
{
Dictionary<string, string> titleMap = new Dictionary<string, string>();
titleMap.Add("TagNo",ResourceCulture.GetString(ResourceCulture.Col_Num, "位号"));
titleMap.Add("PN",ResourceCulture.GetString(ResourceCulture.Col_Name, "物料编码"));
titleMap.Add("PositionNum",ResourceCulture.GetString(ResourceCulture.Col_Position, "料盘位置"));
titleMap.Add("ComCount",ResourceCulture.GetString(ResourceCulture.Col_Count, "数量"));
titleMap.Add("Notes",ResourceCulture.GetString(ResourceCulture.Col_Notes, "注意事项"));
titleMap.Add("ComponentDes",ResourceCulture.GetString(ResourceCulture.Col_Del, "描述"));
titleMap.Add("TagNo", ResourceCulture.GetString(ResourceCulture.Col_Num, "位号"));
titleMap.Add("PN", ResourceCulture.GetString(ResourceCulture.Col_Name, "物料编码"));
titleMap.Add("PositionNum", ResourceCulture.GetString(ResourceCulture.Col_Position, "料盘位置"));
titleMap.Add("ComCount", ResourceCulture.GetString(ResourceCulture.Col_Count, "数量"));
titleMap.Add("Notes", ResourceCulture.GetString(ResourceCulture.Col_Notes, "注意事项"));
titleMap.Add("ComponentDes", ResourceCulture.GetString(ResourceCulture.Col_Del, "描述"));
return titleMap;
}
......@@ -877,7 +919,7 @@ namespace TSA_V
RgbLedController.OpenAll();
}
else
{
{
LedLabelController.OpenAll();
}
}
......@@ -913,14 +955,14 @@ namespace TSA_V
string bomName = cmbList.Text;
List<ComponetInfo> list = CSVBomManager.GetComList(bomName);
foreach (ComponetInfo obj in comList)
{
{
foreach (ComponetInfo currObj in list)
{
if (currObj.PN.Equals(obj.PN)&&currObj.TagNo.Equals(obj.TagNo)&&currObj.PositionNum.Equals(obj.PositionNum))
if (currObj.PN.Equals(obj.PN) && currObj.TagNo.Equals(obj.TagNo) && currObj.PositionNum.Equals(obj.PositionNum))
{
//如果数量不同才修改
//if (currObj.ComCount != obj.ComCount)
{
{
ComponetUploadInfo upload = new ComponetUploadInfo();
upload.Id = currObj.Id;
upload.PN = currObj.PN;
......@@ -935,12 +977,12 @@ namespace TSA_V
}
}
if(uploadList.Count <= 0)
if (uploadList.Count <= 0)
{
}
FrmComCountView frmListViewer = new FrmComCountView (uploadList );
FrmComCountView frmListViewer = new FrmComCountView(uploadList);
List<ComponetInfo> newList = new List<ComponetInfo>();
DialogResult showRes = frmListViewer.ShowDialog();
if (showRes.Equals(DialogResult.OK))
......@@ -966,9 +1008,107 @@ namespace TSA_V
CSVBomManager.AddBom(bomName, newList);
UpdateGridList(list);
MessageBox.Show(ResourceCulture.GetString("SaveOk", "保存成功!" ));
MessageBox.Show(ResourceCulture.GetString("SaveOk", "保存成功!"));
}
}
}
private void lklSelImage_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
openFileDialogImg.Filter = "Image Files|*.bmp;*.jpg;*.gif;*.png;*jpeg|gerber Files|*.*";
openFileDialogImg.Multiselect = true;
//string directory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);//桌面路径
openFileDialogImg.InitialDirectory =Setting_NInit .Data_LastOpenImagePath;
if (openFileDialogImg.ShowDialog() == DialogResult.OK)
{
string[] files = openFileDialogImg.FileNames;
string defPath = Path.GetPathRoot(Application.StartupPath) + @"image\";
FrmNImageViewer imageViewer;
//List<string> newFiles = FileUtil.FileProcess(openFileDialog.FileNames);
GerberVS.BoundingBox boxBound = GerberVS.AGerberController.OpenLayers(files, defPath, out string filename);
if (boxBound != null && File.Exists(filename))
{
double x = boxBound.Right - boxBound.Left;
double y = boxBound.Top - boxBound.Bottom;
string msg = $"位置左下角({Math.Round(boxBound.Left, 2)},{Math.Round(boxBound.Bottom, 2)})," +
$"右上角({Math.Round(boxBound.Right, 2)},{Math.Round(boxBound.Top, 2)}):尺寸:{Math.Round(x, 2)}X{Math.Round(y, 2)}";
LogUtil.info($"gerber文件【{string.Join(",", files)}】成功导入到文件:{filename},{msg}");
imageViewer = new FrmNImageViewer(filename, 1);
imageViewer.WindowState = FormWindowState.Normal;
if (!imageViewer.ShowDialog().Equals(DialogResult.Cancel))
{
picImage.Image = imageViewer.lastImage;
}
Setting_NInit.Data_LastOpenImagePath = Path.GetDirectoryName(files[0]);
}
else
{
List<string> fileTypes = new List<string>() { ".bmp", ".jpg", ".gif", ".png", ".jpeg" };
bool ok = false;
foreach (string file in files)
{
string ext = Path.GetExtension(file);
if (fileTypes.Contains(ext.ToLower()))
{
ok = true;
imageViewer = new FrmNImageViewer(openFileDialogImg.FileName, 1);
imageViewer.WindowState = FormWindowState.Normal;
if (!imageViewer.ShowDialog().Equals(DialogResult.Cancel))
{
openFileDialogImg.Tag = true;
picImage.Image = imageViewer.lastImage;
}
Setting_NInit.Data_LastOpenImagePath = Path.GetDirectoryName(file);
}
if (!ok)
{
MessageBox.Show(ResourceCulture.GetString("FileError", "文件格式错误 "));
}
}
}
}
}
private void picImage_DoubleClick(object sender, EventArgs e)
{
if (picImage.Image != null)
{
//保存图片,然后编辑此图片
string fileName = Path.Combine(Application.StartupPath + Setting_NInit.Device_ComImagePath + "temp.bmp");
try
{
Image backImage = Eyemlib.DeepClone(picImage.Image);
backImage.Save(fileName);
FrmNImageViewer imageViewer = new FrmNImageViewer(fileName, 1);
imageViewer.WindowState = FormWindowState.Normal;
if (!imageViewer.ShowDialog().Equals(DialogResult.Cancel))
{
if (imageViewer.lastImage != null)
{
openFileDialogImg.Tag = true;
picImage.Image = imageViewer.lastImage;
}
}
}catch(Exception ex)
{
LogUtil.error("出错:" + ex.ToString());
}
finally
{
if (File.Exists(fileName))
{
File.Delete(fileName);
}
}
}
}
}
}
此文件的差异太大,无法显示。
......@@ -51,14 +51,10 @@ namespace TSA_V
lblMsg.Text = "";
Setting_NInit.ChangeConfig();
AGerberController.ErrorLogEvent += AGerberController_ErrorLogEvent;
//if (FormManager.UserInfo.Limit.Equals(UserLimit.Admin))
//{
// btnMaintenance.Visible = true;
//}
//else
//{
// btnMaintenance.Visible = false ;
//}
if (String.IsNullOrEmpty(Setting_NInit.Data_LastOpenImagePath))
{
Setting_NInit.Data_LastOpenImagePath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
}
}
private void AGerberController_ErrorLogEvent(Exception ex)
......
......@@ -931,6 +931,14 @@ namespace TSA_V
/// 元器件【{0}】已配置位置【{1}】,请重新输入位置
/// </summary>
public static string PnHasPos = "PnHasPos";
/// <summary>
/// 图片名称
/// </summary>
public static string Column_imgName = "Column_imgName";
/// <summary>
/// 图片
/// </summary>
public static string Column_img = "Column_img";
}
}
......@@ -431,14 +431,10 @@ namespace TSA_V
}
private void btnOpenFile_Click(object sender, LinkLabelLinkClickedEventArgs e)
{
openFileDialogImg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
//openFileDialogImg.DefaultExt = "jpg|gif|bmp|png|jpeg";
//openFileDialogImg.Filter = "jpg|*.jpg|gif|*.gif|bmp|*.bmp|png|*.png|jpeg|*.jpeg";
{
openFileDialogImg.Filter = "Image Files|*.bmp;*.jpg;*.gif;*.png;*jpeg|gerber Files|*.*";
openFileDialogImg.Multiselect = true;
string directory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);//桌面路径
openFileDialogImg.InitialDirectory = directory;
openFileDialogImg.Multiselect = true;
openFileDialogImg.InitialDirectory = Setting_NInit.Data_LastOpenImagePath;
if (openFileDialogImg.ShowDialog() == DialogResult.OK)
{
......@@ -476,6 +472,7 @@ namespace TSA_V
{
txtBoardW.Text = w.ToString();
}
Setting_NInit.Data_LastOpenImagePath =Path.GetDirectoryName( files[0]);
}
}
else
......@@ -493,6 +490,7 @@ namespace TSA_V
this.txtImagePath.Text = openFileDialogImg.FileName;
return;
}
Setting_NInit.Data_LastOpenImagePath = Path.GetDirectoryName(file);
}
}
MessageBox.Show(ResourceCulture.GetString("FileError", "文件格式错误 "));
......
......@@ -15,6 +15,7 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using TSA_V.LoadCSVLibrary;
using System.Drawing.Imaging;
using AOI;
namespace TSA_V
{
......@@ -353,20 +354,59 @@ namespace TSA_V
BoardInfo board = (BoardInfo)cmbBoardList.SelectedItem;
board.imageByte = BoardManager.ImgToByte(board.GetImgPath());
for (int i= 0;i < board.smtList.Count; i++){
SMTPointInfo p = board.smtList[i];
board.smtList[i].componet = CSVBomManager.GetCom(board.boardName, p);
//for (int i= 0;i < board.smtList.Count; i++){
// SMTPointInfo p = board.smtList[i];
// board.smtList[i].componet = CSVBomManager.GetCom(board.bomName, p);
// //优先使用bom的位置
// if(board.smtList[i].componet!=null)
// {
// string bomPos = board.smtList[i].componet.PositionNum;
// if (p.PositionNum!=bomPos )
// {
// p.PositionNum = bomPos;
// }
// //图片设置为base64格式
// string path = board.smtList[i].componet.ImagePath(board.bomName);
// if (File.Exists(path))
// {
// Image image = Image.FromFile(path);
// board.smtList[i].componet.ImgBase64Data = ImageUtilM.BitMapToBase64(Eyemlib.DeepClone(image));
// }
// }
//}
for (int i = 0; i < board.smtList.Count; i++)
{
ComponetInfo obj = CSVBomManager.GetCom(board.bomName, board.smtList[i]);
//优先使用bom的位置
if(board.smtList[i].componet!=null)
if (obj != null)
{
if (board.smtList[i].PositionNum != obj.PositionNum)
{
board.smtList[i].PositionNum = obj.PositionNum;
}
}
board.smtList[i].componet = null;
}
List<ComponetInfo> componetInfos = CSVBomManager.GetComList(board.bomName);
if (componetInfos != null && componetInfos.Count > 0)
{
board.componetList = new List<ComponetInfo>();
foreach (ComponetInfo obj in componetInfos)
{
string bomPos = board.smtList[i].componet.PositionNum;
if (p.PositionNum!=bomPos )
//图片设置为base64格式
string path = obj.ImagePath(board.bomName);
if (File.Exists(path))
{
p.PositionNum = bomPos;
}
Image image = Image.FromFile(path);
obj.ImgBase64Data = ImageUtilM.BitMapToBase64(Eyemlib.DeepClone(image));
}
board.componetList.Add(obj);
}
}
SaveFileDialog sfd = new SaveFileDialog();
sfd.FileName = "";
sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
......@@ -387,6 +427,7 @@ namespace TSA_V
MessageBox.Show(ResourceCulture.GetString("成功导出程序到文件:")+"\r\n" + filePath, ResourceCulture.GetString("提示"));
}
}
board.componetList = null;
}
}
......
......@@ -18,10 +18,17 @@ namespace TSA_V
{
private string fileName = "";
private bool update = false;
public FrmNImageViewer(string fileName)
public Image lastImage = null;
/// <summary>
/// 选择图片的方式0=新增电路板。1=元器件图片
/// </summary>
public int SelType=0;
public FrmNImageViewer(string fileName,int type=0)
{
InitializeComponent();
this.fileName = fileName;
this.SelType = type;
}
private void FrmImageViewer_Load(object sender, EventArgs e)
......@@ -30,6 +37,8 @@ namespace TSA_V
{
System.Drawing.Image img = System.Drawing.Image.FromFile(fileName);
Bitmap myImage = new System.Drawing.Bitmap(img);
lastImage = myImage;
this.picViewer.Image = myImage;
img.Dispose();
......@@ -64,11 +73,22 @@ namespace TSA_V
{
if (update)
{
//备份原图
BackFile();
Image newImage = (Image)picViewer.Image.Clone();
newImage.Save(fileName);
LogUtil.info("保存修改后的图片:" + fileName);
if (SelType == 0)
{
//备份原图
BackFile();
Image newImage = (Image)picViewer.Image.Clone();
lastImage = newImage;
newImage.Save(fileName);
LogUtil.info("保存修改后的图片:" + fileName);
}
else
{
Image newImage = (Image)picViewer.Image.Clone();
lastImage = newImage;
LogUtil.info($"SelType={SelType}不需要保存图片");
}
}
this.DialogResult = DialogResult.OK;
......
......@@ -46,16 +46,16 @@
this.btnTest = new System.Windows.Forms.Button();
this.btnStart = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnCancel = new System.Windows.Forms.Button();
this.btnSave = new System.Windows.Forms.Button();
this.lblComNotices = new System.Windows.Forms.Label();
this.lblComName = new System.Windows.Forms.Label();
this.lblPartNum = new System.Windows.Forms.Label();
this.lblPositionNum = new System.Windows.Forms.Label();
this.lblComDes = new System.Windows.Forms.Label();
this.lblComName = new System.Windows.Forms.Label();
this.lblPointName = new System.Windows.Forms.Label();
this.lblStart = new System.Windows.Forms.Label();
this.lblLast = new System.Windows.Forms.Label();
this.btnCancel = new System.Windows.Forms.Button();
this.btnSave = new System.Windows.Forms.Button();
this.lblComNotices = new System.Windows.Forms.Label();
this.txtCount = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.btnUpateCount = new System.Windows.Forms.Button();
......@@ -101,6 +101,9 @@
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.btnResetAOI = new System.Windows.Forms.Button();
this.lblShortageInfo = new System.Windows.Forms.Label();
this.groupPNImg = new System.Windows.Forms.GroupBox();
this.panPNImg = new System.Windows.Forms.Panel();
this.picPNImg = new System.Windows.Forms.PictureBox();
this.groupBox3.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
......@@ -113,6 +116,9 @@
this.panHand.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picHandsVideo)).BeginInit();
this.menuStrip1.SuspendLayout();
this.groupPNImg.SuspendLayout();
this.panPNImg.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picPNImg)).BeginInit();
this.SuspendLayout();
//
// timer
......@@ -338,6 +344,55 @@
this.groupBox1.TabStop = false;
this.groupBox1.Text = "组装信息:";
//
// btnCancel
//
this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCancel.Location = new System.Drawing.Point(558, 71);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(68, 43);
this.btnCancel.TabIndex = 281;
this.btnCancel.Text = "取消";
this.btnCancel.UseVisualStyleBackColor = false;
this.btnCancel.Visible = false;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnSave
//
this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnSave.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSave.Location = new System.Drawing.Point(489, 71);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(68, 43);
this.btnSave.TabIndex = 280;
this.btnSave.Text = "保存";
this.btnSave.UseVisualStyleBackColor = false;
this.btnSave.Visible = false;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// lblComNotices
//
this.lblComNotices.AutoSize = true;
this.lblComNotices.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblComNotices.ForeColor = System.Drawing.Color.Red;
this.lblComNotices.Location = new System.Drawing.Point(160, 111);
this.lblComNotices.Name = "lblComNotices";
this.lblComNotices.Size = new System.Drawing.Size(50, 26);
this.lblComNotices.TabIndex = 279;
this.lblComNotices.Text = "暂无";
//
// lblComName
//
this.lblComName.AutoSize = true;
this.lblComName.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblComName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.lblComName.Location = new System.Drawing.Point(216, 111);
this.lblComName.Name = "lblComName";
this.lblComName.Size = new System.Drawing.Size(50, 26);
this.lblComName.TabIndex = 2;
this.lblComName.Text = "暂无";
this.lblComName.Visible = false;
//
// lblPartNum
//
this.lblPartNum.AutoSize = true;
......@@ -371,18 +426,6 @@
this.lblComDes.TabIndex = 3;
this.lblComDes.Text = "暂无";
//
// lblComName
//
this.lblComName.AutoSize = true;
this.lblComName.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblComName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.lblComName.Location = new System.Drawing.Point(216, 111);
this.lblComName.Name = "lblComName";
this.lblComName.Size = new System.Drawing.Size(50, 26);
this.lblComName.TabIndex = 2;
this.lblComName.Text = "暂无";
this.lblComName.Visible = false;
//
// lblPointName
//
this.lblPointName.AutoSize = true;
......@@ -418,43 +461,6 @@
this.lblLast.Text = "注意:当前最后一步,即将开始新程序";
this.lblLast.Visible = false;
//
// btnCancel
//
this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCancel.Location = new System.Drawing.Point(558, 71);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(68, 43);
this.btnCancel.TabIndex = 281;
this.btnCancel.Text = "取消";
this.btnCancel.UseVisualStyleBackColor = false;
this.btnCancel.Visible = false;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnSave
//
this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnSave.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSave.Location = new System.Drawing.Point(489, 71);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(68, 43);
this.btnSave.TabIndex = 280;
this.btnSave.Text = "保存";
this.btnSave.UseVisualStyleBackColor = false;
this.btnSave.Visible = false;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// lblComNotices
//
this.lblComNotices.AutoSize = true;
this.lblComNotices.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblComNotices.ForeColor = System.Drawing.Color.Red;
this.lblComNotices.Location = new System.Drawing.Point(160, 111);
this.lblComNotices.Name = "lblComNotices";
this.lblComNotices.Size = new System.Drawing.Size(50, 26);
this.lblComNotices.TabIndex = 279;
this.lblComNotices.Text = "暂无";
//
// txtCount
//
this.txtCount.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
......@@ -950,11 +956,47 @@
this.lblShortageInfo.Size = new System.Drawing.Size(0, 17);
this.lblShortageInfo.TabIndex = 283;
//
// groupPNImg
//
this.groupPNImg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.groupPNImg.Controls.Add(this.panPNImg);
this.groupPNImg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupPNImg.Location = new System.Drawing.Point(658, 420);
this.groupPNImg.Name = "groupPNImg";
this.groupPNImg.Size = new System.Drawing.Size(150, 150);
this.groupPNImg.TabIndex = 4;
this.groupPNImg.TabStop = false;
this.groupPNImg.Visible = false;
//
// panPNImg
//
this.panPNImg.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panPNImg.Controls.Add(this.picPNImg);
this.panPNImg.Location = new System.Drawing.Point(5, 13);
this.panPNImg.Name = "panPNImg";
this.panPNImg.Size = new System.Drawing.Size(141, 129);
this.panPNImg.TabIndex = 3;
//
// picPNImg
//
this.picPNImg.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.picPNImg.Location = new System.Drawing.Point(1, 3);
this.picPNImg.Name = "picPNImg";
this.picPNImg.Size = new System.Drawing.Size(138, 123);
this.picPNImg.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picPNImg.TabIndex = 1;
this.picPNImg.TabStop = false;
//
// FrmWork
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1479, 652);
this.Controls.Add(this.groupPNImg);
this.Controls.Add(this.lblShortageInfo);
this.Controls.Add(this.btnWorkInfo);
this.Controls.Add(this.btnResetAOI);
......@@ -1001,6 +1043,9 @@
((System.ComponentModel.ISupportInitialize)(this.picHandsVideo)).EndInit();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.groupPNImg.ResumeLayout(false);
this.panPNImg.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.picPNImg)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
......@@ -1080,5 +1125,8 @@
private System.Windows.Forms.LinkLabel linkLabel1;
private System.Windows.Forms.Button btnResetAOI;
private System.Windows.Forms.Label lblShortageInfo;
private System.Windows.Forms.GroupBox groupPNImg;
private System.Windows.Forms.Panel panPNImg;
private System.Windows.Forms.PictureBox picPNImg;
}
}
\ No newline at end of file
......@@ -680,6 +680,21 @@ namespace TSA_V
Setting_NInit.Work_ProcedureName = "";
Setting_NInit.Work_TagNumber = 0;
}
if (com.GetImage(BoardManager.CurrBoard.bomName) != null)
{
picPNImg.SizeMode = PictureBoxSizeMode.Zoom;
picPNImg.Image = com.imgInfo;
panPNImg.Visible = true;
groupPNImg.Visible = true;
}
else
{
picPNImg.Image = null;
panPNImg.Visible = false;
groupPNImg.Visible = false;
}
#endregion
}
else
......@@ -1156,20 +1171,20 @@ namespace TSA_V
private void WriteStateStr()
{
return;
//全局图(粉色表示已完成;橘色表示未开始;红色表示实时位置) 12, 327
//Graphics g = e.Graphics;
Graphics g= groupBoard.CreateGraphics();
Font f = new Font("微软雅黑", 10.5F);
string end = ResourceCulture.GetString(ResourceCulture.State_End, "已完成");
string notStart = ResourceCulture.GetString(ResourceCulture.State_NotStart, "未开始");
string postion = ResourceCulture.GetString(ResourceCulture.State_Postiion, "实时位置");
int width = groupBoard.Size.Width;
g.DrawString(end, f, Brushes.HotPink, width-260, 0);
g.DrawString(notStart, f, Brushes.Orange, width-160, 0);
g.DrawString(postion, f, Brushes.Red, width-80, 0);
////全局图(粉色表示已完成;橘色表示未开始;红色表示实时位置) 12, 327
////Graphics g = e.Graphics;
//Graphics g= groupBoard.CreateGraphics();
//Font f = new Font("微软雅黑", 10.5F);
//string end = ResourceCulture.GetString(ResourceCulture.State_End, "已完成");
//string notStart = ResourceCulture.GetString(ResourceCulture.State_NotStart, "未开始");
//string postion = ResourceCulture.GetString(ResourceCulture.State_Postiion, "实时位置");
//int width = groupBoard.Size.Width;
//g.DrawString(end, f, Brushes.HotPink, width-260, 0);
//g.DrawString(notStart, f, Brushes.Orange, width-160, 0);
//g.DrawString(postion, f, Brushes.Red, width-80, 0);
////g.Dispose();
//g.Flush();
//g.Dispose();
g.Flush();
g.Dispose();
}
private void btnIo_Click(object sender, EventArgs e)
......@@ -1198,6 +1213,9 @@ namespace TSA_V
groupBoard.Size = new Size(picBoard.Width + 6, picBoard.Height + 6);
groupBoard.Location = new Point(groupBox2.Location.X + groupBox2.Width - groupBoard.Width, groupBox2.Location.Y + groupBox2.Height - groupBoard.Height);
}
groupPNImg.Size = new Size(groupBox2.Width / 5, groupBox2.Height / 5);
groupPNImg.Location = new Point(groupBox2.Location.X, groupBox2.Location.Y + groupBox2.Height - groupPNImg.Height);
}
private void StartVideo()
......
......@@ -98,8 +98,10 @@ namespace TSA_V
int index = 0;
foreach (SMTPointInfo weld in pointList)
{
float x = (float)Math.Abs(weld.PositionX) * imageXiShu;
float y = (float)Math.Abs(weld.PositionY) * imageXiShu;
//float x = (float)Math.Abs(weld.PositionX) * imageXiShu;
//float y = (float)Math.Abs(weld.PositionY) * imageXiShu;
float x = (float) weld.PositionX * imageXiShu;
float y = (float) weld.PositionY * imageXiShu;
int lineLength = 8;
Color color = Color.HotPink;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!