コード例 #1
0
        public void Loaded()
        {
            // SET added to True
            added = true;
            // DECLARE a new Size, set it to the display views PictureBox size
            Size newSize = this.pictureBox1.Size;
            // DECLARE ICommand called resize and set to new ResizeCommand
            // passing in the resize delegate and the desired size
            ICommand resize = new ResizeCommand(_resize, newSize);

            // CALL to execute delegat passing in the icommand
            _execute(resize);
        }
コード例 #2
0
 private void DisplayView_Resize(object sender, EventArgs e)
 {
     // IF the added bool is true
     if (added && this.MinimumSize.Width >= _minSize.Width && this.MinimumSize.Width >= _minSize.Width)
     {
         // DECLARE a new Size variable and set it to the picture boxes
         // size
         Size newSize = this.pictureBox1.Size;
         // DECLARE a new ICommand and set it to a new ResizeCommand
         // passing in the resize delegate and the desired size
         ICommand resize = new ResizeCommand(_resize, newSize);
         // CALL to ExecuteDelegate passing in the ICommand
         _execute(resize);
     }
 }
コード例 #3
0
        private void DecreaseBtn_Click(object sender, EventArgs e)
        {
            // DECLARE two ints one for width and one for height
            // SET the value of w and h to the width and height of the
            // image - 10% of the images width or height
            int w = this.pictureBox1.Image.Width - this.pictureBox1.Image.Width / 10;
            int h = this.pictureBox1.Image.Height - this.pictureBox1.Image.Height / 10;
            // DECLARE a new Size, set it to the width and height
            Size nSize = new Size(w, h);
            // DECLARE a new ICommand and set it to a new ResizeCommand
            // passing in the resize delegate and the desired size
            ICommand rSize = new ResizeCommand(_resize, nSize);

            // CALL to ExecuteDelegate passing in the ICommand
            _execute(rSize);
        }