Exemplo n.º 1
0
        private void preshow(object sender)
        {
            foreach (Form form in Application.OpenForms)
            {
                if (form.Name.Equals("f2zoom"))
                {
                    form.Focus();
                    return;
                }
            }

            try
            {
                f2picpath[1] = picboxes[((PictureBox)sender).Name];
                if (f2picpath.Equals(null) || ((PictureBox)sender).Image == null)
                {
                    MessageBox.Show("Изображение не найдено");
                    return;
                }

                Form f2 = new f2zoom();
                f2.Size = new Size(this.ClientRectangle.Width - (flowLayoutPanel1.Location.X + 15),
                                   this.ClientRectangle.Height - (treeView.Location.Y) - 3);
                f2.Location = flowLayoutPanel1.PointToScreen(Point.Empty);
                //f2.TransparencyKey = f2.BackColor;
                pic4picform = (Bitmap)((PictureBox)sender).Image;
                f2.Show();
                f2.TopMost = true;

                f2w = f2.Width;
                f2h = f2.Height;
            }
            catch (Exception exc) { MessageBox.Show(exc.Message, "что-то пошло не так"); }
        }
Exemplo n.º 2
0
        private void preshow(object sender)
        {
            foreach (Form form in Application.OpenForms)
            {
                if (form.Name.Equals("f2zoom"))
                {
                    form.Focus();
                    return;
                }
            }

            //Form f2 = new Form();
            //f2.Name = "f2zoom";
            Form f2 = new f2zoom();

            f2.Size = new Size(this.ClientRectangle.Width - (flowLayoutPanel1.Location.X + 3),
                               this.ClientRectangle.Height - (treeView.Location.Y) - 3);
            //f2.StartPosition = FormStartPosition.Manual;
            f2.Location        = flowLayoutPanel1.PointToScreen(Point.Empty);
            f2.TransparencyKey = f2.BackColor;
            //f2.FormBorderStyle = FormBorderStyle.None;
            PictureBox pb = new PictureBox();

            pb.Dock      = DockStyle.Fill;
            pb.SizeMode  = PictureBoxSizeMode.Zoom;
            pb.BackColor = Color.Transparent;
            Bitmap pic = (Bitmap)((PictureBox)sender).Image;

            pb.Image = pic;
            //pb.Image = Image.FromFile(picboxes[((PictureBox)sender).Name]);
            //f2.Size = pb.ClientSize;
            pb.MouseDoubleClick += closepreshow;
            pb.MouseWheel       += new MouseEventHandler(pb_MouseWheel);
            f2.Controls.Add(pb);
            f2.Show();
            f2.TopMost = true;

            f2w = f2.Width;
            f2h = f2.Height;
        }