按钮图像从按钮的顶部太远;太靠近按钮的下方 [英] Button image too far from top of button; too close to bottom of button

查看:154
本文介绍了按钮图像从按钮的顶部太远;太靠近按钮的下方的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作Windows窗体在2005年VB.NET和我想有一些图像按钮(我说的是平原,香草System.Windows.Forms.Button)。我已经一切准备就绪,我希望它的方式,但在图像显示过低的按钮,使得图标的下方是差不多吧按钮的底部,有很多的图像上方的空间。

I'm working on a Windows Form in VB.NET 2005 and I would like to have some buttons with images (I'm talking about the plain, vanilla System.Windows.Forms.Button). I have everything set up the way I want it but the images are displaying too low on the button, such that the bottom of the icon is almost right on the bottom of the button and there is a lot of space above the image.

下面是截图:

Here is a screenshot:

如何看图标的角刷牙对按钮的底部?

See how the corner of the icon is brushing up against the bottom of the button?

我的按钮是23像素高和图像是一个16×16的图标(转换为位图,以便它可分配给该按钮的图像属性)。

My button is 23 pixels high and the image is a 16 x 16 icon (converted to a bitmap so that it can be assigned to the button's Image property).

我试过按钮的Margin.All属性设置为0,并验证了Padding.All属性为0。我也试图改变按钮的ImageAlign到左上,MiddleLeft和BOTTOMLEFT,但没有这些设置似乎有任何影响。

I've tried setting the button's Margin.All property to 0, and verified that the Padding.All property is 0. I've also tried changing the button's ImageAlign to TopLeft, MiddleLeft, and BottomLeft, but none of those settings seem to have any affect.

有谁知道我可以定位图像从按钮的顶部和底部边缘相等的距离?我可以调整按钮或图像,如果必要的,但他们在我的preferred大小,我想如果可能的话,让他们的方式。

Does anyone know how I can position the image to be of equal distance from the top and bottom edges of the button? I can resize the button or the image if necessary but they are at my preferred size and I would like to keep them that way if possible.

推荐答案

通常情况下,我们将设置以下属性(右侧图像为例):

Typically, we'll set the following properties (for an image on the right, for example):

ImageAlign: MiddleRight
TextAlign: MiddleLeft

您会希望以类似的方式对齐文本和图像。以外的是,请确保您设置图像属性,而不是BackgroundImage属性,并确保你做正确的图标为纯位图转换。您是否尝试过一个普通的位图文件?

You'll want to align both the text and image in a similar fashion. Outside of that, make sure that you are setting the Image property, not the BackgroundImage property and make sure you are doing the icon to plain bitmap conversion properly. Have you tried a plain bitmap file?

这篇关于按钮图像从按钮的顶部太远;太靠近按钮的下方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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