//public ImageBaseMouseEnlargeBehavior(ImageCore imageBase) : base(imageBase) //{ //} #region - 绘制矩形框和相关操作 - void ShowPartWithShape(RectangleShape rectangle) { RectangleGeometry rect = new RectangleGeometry(new Rect(0, 0, AssociatedObject._centerCanvas.ActualWidth, AssociatedObject._centerCanvas.ActualHeight)); // Do:设置覆盖的蒙版 var geo = Geometry.Combine(rect, new RectangleGeometry(rectangle.Rect), GeometryCombineMode.Exclude, null); DynamicShape shape = new DynamicShape(rectangle); AssociatedObject.ShowShape(rectangle.Rect); AssociatedObject._dynamic.Visibility = Visibility.Collapsed; }
public override void OnApplyTemplate() { base.OnApplyTemplate(); this._centerCanvas = Template.FindName("PART_CenterCanvas", this) as InkCanvas; this._imageCenter = Template.FindName("PART_ImageCenter", this) as Image; grid_Mouse_drag = Template.FindName("PART_Grid_Mouse_Drag", this) as ContentControl; _svDefault = Template.FindName("PART_ScrollView_Default", this) as ScrollViewer; grid_mark = Template.FindName("PART_Grid_Mark", this) as Grid; vb = Template.FindName("PART_ViewBox_Default", this) as Viewbox; rootGrid = Template.FindName("PART_Grid_Root", this) as Grid; mask = Template.FindName("PART_MarkCanvas_Mark", this) as MaskCanvas; controlmask = Template.FindName("PART_ContentControl_Mark", this) as ContentControl; popup = Template.FindName("PART_Grid_Popup", this) as Grid; BigBox = Template.FindName("PART_Canvas_BigBox", this) as Canvas; bigImg = Template.FindName("PART_Image_Big", this) as Image; bigrect = Template.FindName("PART_RectangleGeometry_Big", this) as RectangleGeometry; grid_all = Template.FindName("PART_Grid_All", this) as Grid; MoveRect = Template.FindName("PART_Ecllipse_Move", this) as Ellipse; _dynamic = Template.FindName("PART_DynamicShape_Draw", this) as DynamicShape; // Do :初始化宽度高度 this.InitWidthHeight(); // Do :初始化设置平铺 this.SetFullImage(); this.NoticeMessaged += (m, n) => Debug.WriteLine(this.Message); //this.behaviors.ForEach(l => l.RegisterBehavior()); }