放大图片框中的部分图像 [英] Zoom in part of the image from picture box

查看:62
本文介绍了放大图片框中的部分图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用C#windows应用程序。我正在使用拆分容器在第一个面板(带滚动条)和第二个面板中的数据输入字段的图片框中显示图像。一个字段将始终位于页面底部,如果不向下滚动则无法看到。我正在尝试在每次加载图片时(基于坐标)显示该区域的一部分放大的东西。如果我能得到一些建议,我将不胜感激。感谢所有的帮助。



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.

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);





我的尝试:



我尝试过另一个图片框来放大图片选择部分(组合框索引已更改)。它适用于坐标直到分割容器中面板1的大小,如果我尝试使用更高的坐标而不是显示图像的底部部分,它会根据坐标显示panel2的顶部或分区。我需要显示图像底部的帮助。



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.

推荐答案

加入windows窗体,只需参考以下链接,这将对你有帮助,

1. 图像放大镜控制 [ ^ ]

2. 简单放大镜 [ ^ ]

3. C#Corner:错误显示 [ ^ ]

4. 如何在C#中制作一个简单的放大镜终极编程教程 [ ^ ]
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[^]


这篇关于放大图片框中的部分图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆