如何将大图像绑定到Windows窗体中的图片框 [英] How to bind a large image to a picture box in windows form

查看:65
本文介绍了如何将大图像绑定到Windows窗体中的图片框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Windows窗体应用程序,它将图像(桌面的屏幕截图)绑定到数据研磨。单击datagrid上的图像时,它应该绑定到大小为715 x 521的图片框。我可以在图片框上裁剪并调整图像大小并将其保存到单独的文件夹中。



现在问题是我的图像尺寸(从桌面截图)是1280 x 1024,图片框大小是715 x 521.



容纳截图图片到图片框我将屏幕截图图像从1280 x 1024调整为715 x 521(图片框大小)。通过在裁剪和调整大小之后这样做,清晰度不好。



所以如何在没有调整大小的情况下将原始图像绑定到图片框,所以在剪裁后我会清晰地看到图片。



所以请建议一种方法,以容纳1280 x 1024图像到715 x 521图片框



谢谢是Advance

I have a windows form application which bind images (Screen shot of desktop) to a data grind. On clicking the image on datagrid it should bind to a Picture box with size 715 x 521. I can do cropping and resizing the image on the picture box and save it to a separate folder.

Now the problem is My image size (From desktop screenshot) is 1280 x 1024 and the Picture box size is 715 x 521.

To accommodate the screenshot image to the picturebox I resize the screenshot image from 1280 x 1024 to 715 x 521 (picturebox size) . By doing this after cropping and resizing the clarity is not good.

so how to bind the original image to the picturebox without resizing, so after cropping i get the picture with good clarity.

So please suggest a method to accommodate a 1280 x 1024 image to 715 x 521 picturebox

Thanks is Advance

推荐答案

从一开始你的整个方法就错了。让我们看看:

  • 您可以操作恒定的屏幕尺寸和图像大小,就像您要对这些尺寸进行硬编码一样。这使你的工作价值等于零。不,在现实生活中你不会有1280 x 1024的截图;你会有不同的尺寸。或者根本没有。
  • 即使固定屏幕和 PictureBox 尺寸是固定的,它们也有不同的宽高比。这没有道理。如果你让它们变量,它会没问题,请看下面。
  • 即使你可以使用 PictureBox ,它也几乎没用。你应该谈谈图像,而 PictureBox 是一种控制,仅适用于大多数琐碎的用途。
  • 谁告诉你必须要 PictureBox 的大小?你应该更好地设计你的UI,没有任何硬编码的大小。体面应用程序应该可以很好地调整大小,并且显示屏幕截图的这种元素是第一个成为可由用户调整为任何方便大小的元素的候选者。这不是问题,特别是如果你通过 PictureBox


Your whole approach is wrong from the very beginning. Let's see:
  • You operate constant screen size and image size as if you were to hard-code those sizes. That makes the value of your work equal to zero. No, in real life you won't have 1280 x 1024 screenshots; you will have different sizes. Or nothing at all.
  • Even though the fixed screen and PictureBox sizes are fixed, they have different aspect ratios. It makes no sense. If you make them variable, it will be fine, please see below.
  • Even though you could use PictureBox, it is pretty much useless. You should talk about images, and PictureBox is some control, designed only for most trivial uses.
  • Who told you that you have to have PictureBox of the said size? You should design your UI better, without any hard-coded sizes. Decent application should be well resizeable, and such element showing the screen shot is the first candidate to become the element resizeable by the user to any convenient size. It cannot be a problem, especially if you through out the PictureBox.


这篇关于如何将大图像绑定到Windows窗体中的图片框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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