private void ImageDeleteComfirmForm_Load(object sender, EventArgs e) { int n = MainForm.tot; int i = n - (int)((double)n * delete_rate / 100); int tot = 0; for (; i < n; i++, tot++) { picturePanel p = new picturePanel(); if (tot % 4 == 0) { result.RowStyles.Insert(result.RowCount++, new RowStyle()); } result.Controls.Add(p, tot % 4, tot / 4); p.init(MainForm.picInfo[MainForm.path_name[i]].image, "质量分数:" + (sortArray[i].grade / sortArray[0].grade * 100).ToString("f2")); } TableLayoutRowStyleCollection rowstyles; rowstyles = result.RowStyles; foreach (RowStyle style in rowstyles) { style.SizeType = SizeType.Absolute; style.Height = result.Width / 4 - 20; } this.Refresh(); }
private void compressForm_none_Load(object sender, EventArgs e) { picturePanel p1 = new picturePanel(); uncompressed.Controls.Add(p1); p1.init(MainForm.picInfo[_path].image, _name); picturePanel p2 = new picturePanel(); compressed.Controls.Add(p2); }
private void CompareForm_Load(object sender, EventArgs e) { //添加两个PictureBox作为图像容器 PictureBox image1 = new PictureBox(); PictureBox image2 = new PictureBox(); int id1 = 0, id2 = 0; for (int i = 0; i < MainForm.tot; i++) { if (MainForm.selected[i]) { id1 = i; //获得被选中的图像的id,这里只选一张图片 break; } } for (int i = id1 + 1; i < MainForm.tot; i++) { if (MainForm.selected[i]) { id2 = i; //获得被选中的图像的id,这里只选一张图片 break; } } picturePanel p1 = new picturePanel(); picturePanel p2 = new picturePanel(); compare_image_1.Controls.Add(p1); compare_image_2.Controls.Add(p2); p1.init(MainForm.picInfo[MainForm.path_name[id1]].image, MainForm.name[id1]); p2.init(MainForm.picInfo[MainForm.path_name[id2]].image, MainForm.name[id2]); int score1 = (int)(new Pic(MainForm.path_name[id1])).tenengrad(); int score2 = (int)(new Pic(MainForm.path_name[id2])).tenengrad(); compare_image_score_1.Text = "得分:" + score1.ToString(); compare_image_score_2.Text = "得分:" + score2.ToString(); if (score1 > score2) { op.Text = ">"; } else if (score1 < score2) { op.Text = "<"; } else { op.Text = "="; } }
private void compressForm_full_Load(object sender, EventArgs e) { int id = 0; for (int i = 0; i < MainForm.tot; i++) { if (MainForm.selected[i]) { id = i; //获得被选中的图像的id,这里只选一张图片 break; } } picturePanel p1 = new picturePanel(); picturePanel p2 = new picturePanel(); uncompressed.Controls.Add(p1); compressed.Controls.Add(p2); p1.init(MainForm.picInfo[MainForm.path_name[id]].image, null); p2.init(null, null); }
private void SortingResult_Load(object sender, EventArgs e) { if (_path != null) { picturePanel p = new picturePanel(); referenceImage.Controls.Add(p); p.init(MainForm.picInfo[_path].image, null); hint.Text = "全参考排序参考图"; } TableLayoutColumnStyleCollection columnstyles = beforeSortingPanel.ColumnStyles; foreach (ColumnStyle style in columnstyles) { style.SizeType = SizeType.Absolute; style.Width = size; } columnstyles = afterSortingPanel.ColumnStyles; foreach (ColumnStyle style in columnstyles) { style.SizeType = SizeType.Absolute; style.Width = size; } for (int i = 0; i < MainForm.tot; i++) { picturePanel p = new picturePanel(); beforeSortingPanel.ColumnStyles.Insert(beforeSortingPanel.ColumnCount++, new ColumnStyle(SizeType.Absolute, size)); beforeSortingPanel.Controls.Add(p, i, 0); p.init(MainForm.picInfo[MainForm.path_name_copy[i]].image, MainForm.name_copy[i]); } for (int i = 0; i < MainForm.tot; i++) { picturePanel p = new picturePanel(); afterSortingPanel.ColumnStyles.Insert(afterSortingPanel.ColumnCount++, new ColumnStyle(SizeType.Absolute, size)); afterSortingPanel.Controls.Add(p, i, 0); p.init(MainForm.picInfo[MainForm.path_name[i]].image, MainForm.name[i]); } }
//添加图片到左边工作区 bool add_image(string path, string _name) { if (existed_images.Contains(path)) { return(false); //图片已经存在,添加失败 } existed_images.Add(path); Pic pic = new Pic(path); picInfo.Add(path, pic); //添加新的图片单元格 if (tot % 5 == 0) { result_show.RowStyles.Insert(result_show.RowCount++, new RowStyle()); TableLayoutRowStyleCollection rowstyles; rowstyles = result_show.RowStyles; foreach (RowStyle style in rowstyles) { style.SizeType = SizeType.Absolute; style.Height = result_show.Width / 5; } } name[tot] = _name; picturePanel p = new picturePanel(); p.Name = tot.ToString(); p.BackColor = unselected_color; p.image.MouseDoubleClick += new MouseEventHandler(image_MouseDoubleClick); p.image.Name = tot.ToString(); result_show.Controls.Add(p, tot % 5, tot / 5); p.init(MainForm.picInfo[path].image, _name); path_name[tot] = path; result_show.Refresh(); tot++; return(true); //成功添加图片 }