void GetTargetEvent(TargetImg obj) { if (obj != null) { //TODO: Image i = Image.FromFile(obj.FilePath); PicBox_TargetImg.Image = i; PicBox_TargetImg.SizeMode = PictureBoxSizeMode.Zoom; lable_TargetName.Text = obj.TargetName; } }
private static void LoadTargetList() { //加载靶标 DirectoryInfo dir = new DirectoryInfo(Global.TargetImagesPath + "Targets\\"); FileInfo[] files = dir.GetFiles("*.png"); if (files.Length > 0) { TargetImgList = new List<TargetImg>();//创建 foreach (FileInfo file in files) { TargetImg targetimg = new TargetImg(); targetimg.TargetName = file.Name.Split('.')[0]; targetimg.FilePath = file.FullName.ToString(); TargetImgList.Add(targetimg); } } else { throw new Exception("There is no Targets!"); } }