public void SetImage(System.Drawing.Bitmap bitmap_) { using (var bitmap = new Movable <System.Drawing.Bitmap>(bitmap_)) { using (var safeHandle = new SafeHBitmapHandle(bitmap.Get().GetHbitmap())) { this.CopiedImage.Source = Imaging.CreateBitmapSourceFromHBitmap(safeHandle.Handle, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); } } this.SizeToContent = SizeToContent.WidthAndHeight; }
public void SetImage(System.Drawing.Bitmap bitmap_) { using (var bitmap = new Movable <System.Drawing.Bitmap>(bitmap_)) { using (var safeHandle = new SafeHBitmapHandle(bitmap.Get().GetHbitmap())) { this.CopiedImage.Source = Imaging.CreateBitmapSourceFromHBitmap(safeHandle.Handle, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); } } this.CapturingCanvas.Children.Add(this.CopiedImage); //var t = new TextBox(); //t.Text = string.Format("{0}-{1} / {2}-{3}", this.Left, this.Top, this.Width, this.Height); //this.CapturingCanvas.Children.Add(t); }