protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Image> e) { base.OnElementChanged(e); if (e.OldElement != null) { } if (e.NewElement != null) { ImageTouch = (ImageTouch)e.NewElement; } }
private void button3_Click(object sender, EventArgs e) { ImageTouch it = new ImageTouch(); ///Dictionary<string, Image<Bgr, byte>> BgrImageDic = new Dictionary<string, Image<Bgr, byte>>(); List <string> imgpaths = new List <string>(); string path = FolderPath(); var files = Directory.GetFiles(path, "*.jpg"); for (int i = 0; i < files.Count(); i++) { var imgpath = files[i]; //img = new Image<Bgr, byte>(imgpath); imgpaths.Add(imgpath); } it.ImagePath = imgpaths; it.Shrink(); MessageBox.Show("转化完成"); }
protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Image> e) { try { base.OnElementChanged(e); if (e.OldElement != null) { Control.Touch -= Control_Touch; } if (e.NewElement != null) { ImageTouch = (ImageTouch)e.NewElement; Control.Touch += Control_Touch; } } catch (Exception e1) { ExceptionHandler.Catch(e1); } }