Пример #1
0
        private Rectangle SetBounds(Rectangle value, bool usingMargin)
        {
            usingMargin = false;
            bool changedBounds           = _bounds != value;
            bool changedLocation         = _bounds.Location != value.Location;
            bool changedSize             = _bounds.Size != value.Size;
            BoundsChangedArgs boundsArgs = new BoundsChangedArgs();

            boundsArgs.NewBounds = value;
            boundsArgs.OldBounds = _bounds;
            _bounds = value;
            PostCommand(new Commands.ViewSetBounds(this));
            if (changedBounds)
            {
                OnPropertyChanged(new PropertyChangedEventArgs("Bounds"));
                OnBoundsChanged(boundsArgs);
            }
            if (changedLocation)
            {
                OnPropertyChanged(new PropertyChangedEventArgs("Location"));
            }
            if (changedSize)
            {
                OnPropertyChanged(new PropertyChangedEventArgs("Size"));
            }
            return(value);
        }
Пример #2
0
        /// <summary>
        /// Raises the BoundsChanged event
        /// </summary>
        /// <param name="e">Contains the old bounds and the new bounds.</param>
        protected virtual void OnBoundsChanged(BoundsChangedArgs e)
        {
            EventHandler <BoundsChangedArgs> handler = BoundsChanged;

            if (handler != null)
            {
                handler(this, e);
            }
        }