StatusBar/分隔符显示问题 [英] StatusBar / Separator display question

查看:87
本文介绍了StatusBar/分隔符显示问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在玩StatusBar和Separator.我对于为什么只用一个像素作为分隔符感到困惑.我想我应该得到一条细的垂直线,因为控件的大小被指定为宽1个单位,高15个单位.

I've been playing around with StatusBar and Separator.  I'm confused as to why I'm only getting a single pixel as the separator.  I would think I should be getting a thin vertical line as the size of the control is being specified as being 1 unit wide, and 15 units high.

我对分隔符的XAML语句是:

My XAML statement for the separator is:

如果将高度指定为大于15的数字,状态栏的高度将增加,但仍然只能显示单个像素.如果我增加Width的值,这很有趣,我的确会得到一条水平线.

If I specify a larger number than 15 for the height, the height of the status bar increases, but I still only get a single pixel displaying.  If I increase the value of Width, interesting enough, I do get a hortizontal line.

我还尝试了Margin ="0,0,0,0&";并且填充="0,0,0,0";但这无济于事.

I also tried Margin="0,0,0,0" and Padding="0,0,0,0" but that didn't help any.

如果有什么不同,我将在XP Pro盒子上的Visual Studio中进行所有操作.

In case it makes any difference, I'm doing all this in Visual Studio on a XP Pro box.

任何人都可以解释发生了什么事吗?

Can anyone explain what's happening?

TIA,

理查德

推荐答案

StatusBar外部的分隔符通常是水平的,因此它们只有1 px高.要在StatusBar中使用分隔符,请勿将其添加到StatusBarItem中,只需将其直接放置在StatusBar中即可. StatusBar将更新Separator的样式,以使用键StatusBar.SeparatorStyleKey指向该样式.与此键关联的默认样式是垂直分隔符.

Separators outside of StatusBars are usually horizontal so they are only 1 px tall.  To use separators in StatusBar, do not add it to a StatusBarItem, just place it directly in the StatusBar.  The StatusBar will update Separator's style to point to the style with key StatusBar.SeparatorStyleKey.  The default style associated with this key is a vertical separator.

< StatusBar VerticalAlignment ="底部><< StatusBarItem> 100%</StatusBarItem><<分隔符背景=蓝色''宽度="1".高度="15". />
< StatusBarItem> Ln 1,第1列</StatusBarItem>
</StatusBar>

<StatusBar VerticalAlignment="Bottom">
    <StatusBarItem>100%</StatusBarItem>
    <Separator Background="Blue" Width="1" Height="15" />
    <StatusBarItem>Ln 1, Col 1</StatusBarItem>
</StatusBar>


这篇关于StatusBar/分隔符显示问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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