/// <summary> /// 鼠标抬起事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InkCanvas_MouseUp(object sender, MouseButtonEventArgs e) { if ((this.ImageOprateCtrEntity.MarkType == MarkType.None)) { return; } // Do:检查选择区域是否可用 if (!_dynamic.IsMatch()) { _dynamic.Visibility = Visibility.Collapsed; return; } ; if (this.start.X <= 0) { return; } // Do:如果是选择局部放大 if (this.r_screen.IsChecked.HasValue && this.r_screen.IsChecked.Value) { RectangleGeometry rect = new RectangleGeometry(new Rect(0, 0, this.canvas.ActualWidth, this.canvas.ActualHeight)); // Do:设置覆盖的蒙版 var geo = Geometry.Combine(rect, new RectangleGeometry(this._dynamic.Rect), GeometryCombineMode.Exclude, null); DynamicShape shape = new DynamicShape(this._dynamic); // Do:设置形状、用来提供给局部放大页面 this.DynamicShape = shape; // Do:设置提供局部放大在全局的范围的视图 this.ImageVisual = this.canvas; this.OnBegionShowPartView(); // Do:设置当前蒙版的剪切区域 this.rectangle_clip.Clip = geo; _dynamic.Visibility = Visibility.Collapsed; } else { this.ImageOprateCtrEntity.OnDrawMarkedMouseUp(); //// Do:不是局部放大功能则显示弹出窗口 //this.popup.IsOpen = true; } // Do:将数据初始化 start = new Point(-1, -1); }
void ShowPartWithShape(RectangleShape rectangle) { RectangleGeometry rect = new RectangleGeometry(new Rect(0, 0, this.canvas.ActualWidth, this.canvas.ActualHeight)); // Do:设置覆盖的蒙版 var geo = Geometry.Combine(rect, new RectangleGeometry(rectangle.Rect), GeometryCombineMode.Exclude, null); DynamicShape shape = new DynamicShape(rectangle); // Do:设置形状、用来提供给局部放大页面 this.DynamicShape = shape; // Do:设置提供局部放大在全局的范围的视图 this.ImageVisual = this.canvas; this.OnBegionShowPartView(); // Do:设置当前蒙版的剪切区域 this.rectangle_clip.Clip = geo; _dynamic.Visibility = Visibility.Collapsed; }