WPF 标签内容对齐
在WPF标签中,是这样对齐的,如果字体大小增加,则标签大小在右下中增加。
是否有可能使其在右上方向增加?
附言。
标签包含在 Canvas
中。
In a WPF label, is aligned like this, that if the font size is increased, the label size increases in bottom-right.
Is there a possibility to make it increase in top-right direction?
PS.
The labels are contained in a Canvas
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您使用 Canvas.Top 指定 Canvas 中的垂直标签位置,则当字体大小增加时,它会向下增长。如果您使用 Canvas.Bottom 指定垂直位置,它将向上生长。 Canvas.Left 和 Canvas.Right 也是如此。
If you specify the Vertical Label position within the Canvas with Canvas.Top it will grow downwards when font-size increases. If you specify Vertical position with Canvas.Bottom it will grow upwards. The same goes for Canvas.Left and Canvas.Right.
设置控件的 Bottom 和 Left 属性。
Set the Bottom and Left properties of the control.
什么样的容器盛放您的标签?
看起来您正在尝试在画布上绘制一个点并添加标签。我建议将两个标签放在一个面板中,以便它们一起缩放,然后将面板放置在画布上的点上。
作为替代方案,您可以考虑在标签上使用
RenderTransform
而不是 FontSize 更改。您可以将标签缩放到更大的尺寸,并设置缩放的中心点来调整其缩放方向。What sort of container is holding your labels?
It looks like you are trying to plot a point on a canvas and add labels. I'd recommend putting both labels in a single panel so they scale together, then just position the panel at the point on the Canvas.
As an alternative, you could look into using a
RenderTransform
on your label instead of a FontSize change. You can Scale the label to a larger size, and set the center point of the Scale to adjust what direction it scales in.