在 ErrorProvider 中填充顶部和底部
在ErrorProvider控件中我们可以使用SetIconPadding();为了设置在图标和控件之间添加的像素数。
这样我们就可以水平移动图标了。
如何在垂直方向上做同样的事情?
我不知道如何扩展或覆盖图标定位。
PS。 SetIconAlignment() 在某些情况下是不够的。我只需设置图标的自定义本地化。
In ErrorProvider control we can use SetIconPadding(); in order to set number of pixels to add between the icon and the control.
In this way we can move icon horizontally.
How to do the same but in vertical?
I don't know how to extend or override icon positioning.
PS. SetIconAlignment() in some situation is not enough. I simply must set custom localization of icon.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,他们没有简单的方法来做到这一点。
通过使用函数
SetIconPadding()< /code>
您只能以水平方式定义图标和控件之间的空间,但也允许负值。
通过调用
SetIconAlignment()
您只能将其放置在控件的左侧或右侧,而不能放置在其上方或下方。要让它发挥作用,一个技巧是在您需要 errorProvider 的控件周围放置一个面板,并使其更高和/或更低。现在,您可以在此容器控件上设置提供程序,而不是直接设置本意控件,并且通过对填充应用负值,您可以将闪烁图标移动到您喜欢的控件上方或下方。
这是某种黑客行为,但我认为他们没有其他方法可以做到这一点。
如上所见,设置ErrorProvider不在控件上。将其设置为面板并将
IconAlignment
设置为TopLeft
并将IconPadding
设置为某个负值(例如 -50),并且您的图标在控件上方闪烁你的意思是。Unfortunately their is no easy way to do this.
By using the function
SetIconPadding()
you can define the space between the icon and the control only in horizontal way, but negative values are also allowed.With calling
SetIconAlignment()
you can only put it somewhere left or right of the control, but not above or below it.A hack to get this to work, would be to put a panel around the control you need the errorProvider for and making it higher and/or lower. Now you can set the provider on this container control instead of the meant control directly and by applying negative values for the padding you can move the blinking icon above or below the control you like.
This is some kind of hackish, but i think their is no other way to do it.
As above to see, set the ErrorProvider not on the control. Set it to the panel and set
IconAlignment
toTopLeft
andIconPadding
to some negative value (eg -50) and your icon is blinking above your control you meant.