我正在尝试设置线条的笔划厚度大于1。 但在网格右侧的直线上,冲程厚度并没有得到很好的应用。 左侧线路正常工作。 代码段
<Grid
x:Name="BottomRightPanel"
Width="500"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Yellow">
<Line
x:Name="line"
Stroke="Black"
StrokeThickness="5"
X1="0"
X2="0"
Y1="0"
Y2="50" />
<Line
x:Name="line1"
Stroke="Black"
StrokeThickness="5"
X1="500"
X2="500"
Y1="0"
Y2="50">
</Line>
</Grid>
截图:
行被裁剪
null
<Line
x:Name="line1"
Stroke="Black"
StrokeThickness="5"
X1="497.5"
X2="497.5"
Y1="0"
Y2="50">
或使用边框
:
<Border Width="500" Background="Yellow"
BorderBrush="Black" BorderThickness="5 0 5 0"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Grid>
<TextBlock />
</Grid>
</Border>
从我的观察来看,你已经为一条像5的线提供了一些厚度,即使它已经被正确地绘制了,由于增加了厚度,它就像505的X位置。
最好你可以在下面调整X位置
null
<Line
x:Name="line"
Stroke="Black"
StrokeThickness="5"
X1="0"
X2="0"
Y1="0"
Y2="50" />
<Line
x:Name="line1"
Stroke="Black"
StrokeThickness="5"
X1="495"
X2="495"
Y1="0"
Y2="50"/>