private List <PicNum> search() { List <PicNum> piclist = new List <PicNum>(); //string keyword = textBox2.Text.ToString(); string keyword = ""; ImageList imageList = new ImageList(); piclist = PBll.GetpicList(keyword); StringCompute stringcompute1 = new StringCompute(); if (piclist.Count > 0 && piclist != null) { for (int i = 0; i < piclist.Count; i++) { stringcompute1.SpeedyCompute(LicensePlateNo, piclist[i].LicensePlateNo); // 计算相似度 decimal rate = stringcompute1.ComputeResult.Rate; // 相似度百分之几,完全匹配相似度为1 piclist[i].similarity = rate; } piclist.Sort(delegate(PicNum p1, PicNum p2) { return(p2.similarity.CompareTo(p1.similarity)); }); } return(piclist); }
private void button4_Click(object sender, EventArgs e) { this.panel3.Controls.Clear(); List <PicNum> piclist = new List <PicNum>(); string keyword = textBox2.Text.ToString(); ImageList imageList = new ImageList(); piclist = PBll.GetpicList(keyword); if (piclist.Count > 0 && piclist != null) { for (int i = 0; i < piclist.Count; i++) { //imageList.Images.Add(Image.FromFile(piclist[i].picPath)); //imageList.ImageSize = new Size(250, 100); //imageList.Tag = piclist[i].OrderId; PictureBox pic = new PictureBox(); pic.Load(piclist[i].picPath); pic.Tag = piclist[i].OrderNo; pic.Size = new Size(300, 100); pic.SizeMode = PictureBoxSizeMode.StretchImage; //pic.Height = 100; //listView1.Controls.Add(pic); pic.Location = new Point(10, i * 100); pic.Click += new System.EventHandler(this.pictureBox_Click);//添加Click事件 this.panel3.Controls.Add(pic); } } else { Label lable = new Label(); lable.Text = "无数据"; this.panel3.Controls.Add(lable); } }