예제 #1
0
 private void catch_ItemClick(object sender, ItemClickEventArgs e)
 {
     try
     {
         var bitmap = pictureEditFile.Image as Bitmap;
         var pattern = pictureEditPattern.Image as Bitmap;
         if (bitmap == null || pattern == null) throw new Exception("Нет изображения");
         using (var builder = new CatchBuilder(pattern))
         {
             Matrix<double> matrix = builder.Catch(bitmap);
             int x, y;
             double value;
             builder.Max(matrix, out x, out y, out value);
             propertyGridControl1.SelectedObject = new Info {X = x, Y = y, Value = value};
             using (Graphics graphics = Graphics.FromImage(bitmap))
             {
                 var pen = new Pen(Color.Red);
                 graphics.DrawRectangle(pen, x, y, pattern.Width, pattern.Height);
             }
         }
     }
     catch (Exception exception)
     {
         XtraMessageBox.Show(exception.Message);
     }
 }
예제 #2
0
 private void vizualize_ItemClick(object sender, ItemClickEventArgs e)
 {
     try
     {
         var bitmap = pictureEditFile.Image as Bitmap;
         var pattern = pictureEditPattern.Image as Bitmap;
         if (bitmap == null || pattern == null) throw new Exception("Нет изображения");
         using (var builder = new CatchBuilder(pattern))
             pictureEditFile.Image = builder.ToBitmap(bitmap);
     }
     catch (Exception exception)
     {
         XtraMessageBox.Show(exception.Message);
     }
 }