如何左右移动PictureBox图像 [英] How do I shift PictureBox image left and right

查看:94
本文介绍了如何左右移动PictureBox图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有很多关于图片框调整的例子但是它们似乎没有做我想做的事情:



我有一个75x900px的图片框和75x1200 +图像。我不想拉伸它。我将图像分成75x75的正方形,并有箭头左右移动选定的框。当我向右滚动时,我想将图像向左移动以显示最右边的框等。我不想移动图片框的位置。



也许图片框是错误的对象吗?我真的不需要滚动条。目前我正在将一堆75x75正方形装配到背景图像中,并在使用箭头时重新排列顺序。

There are lots of examples out there for picturebox adjustments but none of them seem to do what I'm trying to do:

I have a 75x900px picture box and a 75x1200+ image. I don't want to stretch it. I've divided the image up into 75x75 squares and have arrows to move the selected box left and right. When I scroll off to the right I want to shift the image to the left to show the box on the far right, etc. I don't want to move the location of the picturebox.

Maybe picture box is the wrong object to do this with? I don't really need a scroll bar. Currently I'm assembling a bunch of 75x75 squares into the background image and rearranging the order as I use the arrows.

推荐答案

PictureBox 是一个完全冗余的控件,因为每个人都可以做类似的事情。制作自定义控件并按照您想要的方式对齐图像。 当然 ,请勿使用 PictureBox 作为您控件的子级。相反,通过覆盖 Control.OnPaint 来从头开始渲染图像。

PictureBox is a totally redundant control, because everyone can make something similar. Make a custom control and align the image the way you want. Of course, don't use PictureBox as a child of your control. Instead, render the image from scratch, by overriding Control.OnPaint.

这就是全部。


这篇关于如何左右移动PictureBox图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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