Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working with C# windows application. I am using split container to display image in picture box in the first panel(with scroll bar) and data entry fields in the second panel. One field will always be at the bottom of the page which cannot be seen without scrolling down. I am trying for something that will display zoom in part of that area every time picture is loaded(on basis of co-ordinates). I will appreciate if I can get some suggestions. I appreciate all the help.

C#
pictureBox3.Refresh();
                   pictureBox3.BorderStyle = BorderStyle.FixedSingle;
                   Point startpoint = pictureBox2.PointToScreen(new Point(0, 420));
                   Graphics G = this.CreateGraphics();
                   Bitmap screenGrab = new Bitmap(pictureBox2.Image.Width, pictureBox2.Image.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
                   G = Graphics.FromImage(screenGrab);
                   G.CopyFromScreen(startpoint, new Point(0, 0), pictureBox2.Size, CopyPixelOperation.SourceCopy);
                   pictureBox3.Image = screenGrab;
                   pictureBox3.BringToFront();
                   pictureBox3.Visible = true;

pictureBox3.Refresh();
                   Graphics G1 = Graphics.FromImage(pictureBox3.Image);
                   //pictureBox3.CreateGraphics
                   GraphicsPath path = new GraphicsPath();
                   int L = 0;
                   int T = 0;
                   //int X = 1000;
                   //int Y = 1000;
                   L = pictureBox3.Width / 2 + (pictureBox2.Image.Width) / pictureBox2.Width;
                   T = pictureBox3.Height / 2 + pictureBox2.Height - (pictureBox2.Image.Height) / pictureBox2.Height;
                   path.AddRectangle(R1);
                   G1.DrawPath(cpen, path);
                   G1.SetClip(path, CombineMode.Replace);
                  // Clip Magnifying area to screen capture
                   pictureBox3.Refresh();
                   G1.DrawImage(pictureBox2.Image, pictureBox2.Width  - 2*L, 2*T - pictureBox2.Height, pictureBox2.Image.Width +L , pictureBox2.Image.Height -T);


What I have tried:

I have tried with another picture box to magnify that part on image selection(combobox index changed). It works fine for the coordinates till size of panel 1 in splitcontainer, if I try with higher co-ordinates instead of showing bottom part of the image it displays top part of panel2 or the partition depending on the coordinates. I need help with displaying bottom part of the image.
Posted
Updated 17-Mar-16 12:17pm
v3

1 solution

Hi, incaseof windows forms, just refer the following links, this will help you,
1. Image Magnifier Control[^]
2. Simple Magnifier[^]
3. C# Corner : Error Display[^]
4. How To Make A Simple Magnifier In C# | Ultimate Programming Tutorials[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900