コード例 #1
0
 protected virtual void ApplyCroppedBounds(CroppingAdorner ca)
 {
     if (ca == null)
         return;
     if (this.imageToCrop.Source != null)
     {
         ca.ClippingRectangle = ImageToCropper(this.CroppedImageBounds);
         ca.InvalidateVisual();
     }
 }
コード例 #2
0
		private void AddCropToElement(FrameworkElement fel)
		{
			if (_felCur != null)
			{
				RemoveCropFromCur();
			}
            Rect rcInterior = new Rect(
                (double)Rect.GetValue(Canvas.LeftProperty),
                (double)Rect.GetValue(Canvas.TopProperty),
                Rect.Width,
                Rect.Height);
            AdornerLayer aly = AdornerLayer.GetAdornerLayer(fel);
			_clp = new CroppingAdorner(fel, rcInterior);
			aly.Add(_clp);
			imgCrop.Source = _clp.BpsCrop();
			_clp.CropChanged += CropChanged;
			_felCur = fel;
			if (rbRed.IsChecked != true)
			{
				SetClipColorGrey();
			}
		}
コード例 #3
0
        private void AddCropToElement(FrameworkElement fel)
        {
            if (_felCur != null)
            {
                RemoveCropFromCur();
            }
            Rect rcInterior = new Rect(
                fel.ActualWidth * 0.2,
                fel.ActualHeight * 0.2,
                fel.ActualWidth * 0.6,
                fel.ActualHeight * 0.6);
            AdornerLayer aly = AdornerLayer.GetAdornerLayer(fel);
            croppingAdorner = new CroppingAdorner(fel, rcInterior);
            aly.Add(croppingAdorner);

            croppingAdorner.CropChanged += CropChanged;
            _felCur = fel;
            SetClipColorGrey();
        }
コード例 #4
0
 protected virtual void ReportCroppedBounds(CroppingAdorner ca)
 {
     if (ca == null)
         return;
     if (this.imageToCrop.Source != null)
     {
         this.CroppedImageBounds = CropperToImage(ca.ClippingRectangle);
     }
 }