我有一个Visual Studio应用程序,其中一个闪屏图像被切成了“切片”。这些位置是在表单设计器中指定的,因此它们在屏幕上正确排列。但是,当应用程序在中文版的Windows XP上运行时,图像会出现错位。看起来像是图像切片被“炸开”了。
这里发生了什么事?国际版本的Windows对图片的“左上角”坐标是否有不同的含义?如何才能强制图像精确显示在我想要的位置?
发布于 2008-09-16 17:25:15
我们找到了解决方案!显然,图片框在中国的XP PC上展开了,但它们包含的图像却没有。修复方法是添加如下代码:
Me.PictureBoxIcon.Width = Me.PictureBoxIcon.Image.Width
Me.PictureBoxIcon.Height = Me.PictureBoxIcon.Image.Height
Dim loc As New Point
loc.X = Me.PictureBoxIcon.Location.X
loc.Y = Me.PictureBoxIcon.Location.Y + Me.PictureBoxIcon.Height
Me.PictureBoxAbout.Location = loc
Me.PictureBoxAbout.Width = Me.PictureBoxAbout.Image.Width
Me.PictureBoxAbout.Height = Me.PictureBoxAbout.Image.Height希望这对其他人有帮助!
发布于 2008-09-15 21:10:35
在表单的OnLoad事件中,您总是可以显式地设置每个部分的位置。如果从第一个图像的左上角开始,并假设一个按顺序排列图像的数组:
images[0].Location = new Point(0,0);
for (int i = 1; i < images.Length; i++)
{
images[i].Location = new Point(images[i - 1].Location.X + images[i - 1].Width, 0);
}这会将第一个图像设置为左上角,并将所有后续图像设置为紧跟在最后一个图像之后。
https://stackoverflow.com/questions/66293
复制相似问题