예제 #1
0
        /// <summary>
        /// DesignRectangle控件鼠标左键弹起
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void dr_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            DesignRectangle item = sender as DesignRectangle;

            item.ReleaseMouseCapture();
            mouseVerticalPosition   = -1;
            mouseHorizontalPosition = -1;
            if (null != _CurrentDesignCtrl && !this._CurrentDesignCtrl.Equals(item.Tag as FrameworkElement))
            {
                item.Tag = this._CurrentDesignCtrl;
                SetControlFocus(_CurrentDesignCtrl);
            }
            _IDesigntime.UpdateCurrentSelectedCtrl(this._CurrentDesignCtrl);
            if (isMoveByDesignRectangle)
            {   //-->判断当前选中的控件与
                double newTop  = (double)item.GetValue(Canvas.TopProperty);
                double newLeft = (double)item.GetValue(Canvas.LeftProperty);
                ControlModifyPropertyEventArgs ce = new ControlModifyPropertyEventArgs();
                ce.DictProperty.Add("Canvas.Top", newTop);
                ce.DictProperty.Add("Canvas.Left", newLeft);
                ce.ControlName = string.Format("{0}", _CurrentDesignCtrl.Name);
                _ControlPositionMethod(this, ce);
            }
            isMouseCaptured = false;
            e.Handled       = true;

            line_Top.Visibility  = System.Windows.Visibility.Collapsed;
            line_Left.Visibility = System.Windows.Visibility.Collapsed;
        }