private void Manip_Resizing(object sender, ShiftEventArgs e) { //Console.WriteLine("{0},{1},{2},{3}", e.LeftShift, e.TopShift, e.WidthShift, e.HeightShift); Point pos = new Point(_initPos.X + e.LeftShift, _initPos.Y + e.TopShift); Point size = new Point(_initSize.Width + e.WidthShift, _initSize.Height + e.HeightShift); Point endPos = new Point(pos.X + size.X - 5, pos.Y + size.Y - 5); //5个像素偏移,以避开边界。 LayoutDesignModel.RowColumn start = CalcRowColumn(pos); LayoutDesignModel.RowColumn end = CalcRowColumn(endPos); GridBlockManipulator gbm = e.Source as GridBlockManipulator; gbm.ViewModel.Row = start.Row; gbm.ViewModel.Column = start.Column; gbm.ViewModel.RowSpan = end.Row - start.Row + 1; gbm.ViewModel.ColumnSpan = end.Column - start.Column + 1; }
private void Manip_Reposition(object sender, ShiftEventArgs e) { Point pos = new Point(_initPos.X + e.LeftShift, _initPos.Y + e.TopShift); LayoutDesignModel.RowColumn start = CalcRowColumn(pos); GridBlockManipulator gbm = e.Source as GridBlockManipulator; if (start.Row + gbm.ViewModel.RowSpan <= ViewModel.Split) { gbm.ViewModel.Row = start.Row; } if (start.Column + gbm.ViewModel.ColumnSpan <= ViewModel.Split) { gbm.ViewModel.Column = start.Column; } }
private void OnReposition(ShiftEventArgs e) { this.RaiseEvent(e); }
private void OnResizing(ShiftEventArgs e) { this.RaiseEvent(e); }