コード例 #1
0
        private void B_minus_Click(object sender, EventArgs e) //уменьшаем
        {
            if (Scale_img - 10 >= 100)
            {
                Scale_img -= 10;

                pictureBox1.Width  = img.Width * Scale_img / 100;
                pictureBox1.Height = img.Height * Scale_img / 100;

                if (pictureBox1.Width >= splitContainer1.Panel1.Width || pictureBox1.Height >= splitContainer1.Panel1.Height)
                {
                    pictureBox1.Location = new Point(0, 0);
                }
                else
                {
                    pictureBox1.Location = new Point(pictureBox1.Location.X + img.Width / 20, pictureBox1.Location.Y + img.Height / 20);
                }


                //pictureBox1.Controls.Clear();

                foreach (var item in _allItems)
                {
                    //item.SetPosition(item.CurrentPoint);
                    item.Scale(Scale_img);
                }
            }

            label_scale.Text = Scale_img.ToString() + "%";

            //CreateTempPanel(new Point(0,0), 6);
        }
コード例 #2
0
        private void B_plus_Click(object sender, EventArgs e)
        {
            Scale_img += 10; // увеличиваем масштаб

            pictureBox1.Width  = img.Width * Scale_img / 100;
            pictureBox1.Height = img.Height * Scale_img / 100;

            if (pictureBox1.Location.X - img.Width / 20 <= 0 || pictureBox1.Location.Y - img.Height / 20 <= 0)
            {
                pictureBox1.Location = new Point(0, 0);
            }
            else
            {
                pictureBox1.Location = new Point(pictureBox1.Location.X - img.Width / 20, pictureBox1.Location.Y - img.Height / 20);
            }

            //pictureBox1.Controls.Clear();

            foreach (var item in _allItems)
            {
                //item.SetPosition(item.CurrentPoint);
                item.Scale(Scale_img);
            }

            label_scale.Text = Scale_img.ToString() + "%"; // сообщаем это пользователю

            //CreateTempPanel(new Point(0, 0), 6);
        }