水平或垂直 WPF 线限制为 125,000 像素? [英] Horizontal or vertical WPF Lines limited to 125,000 pixels?

查看:14
本文介绍了水平或垂直 WPF 线限制为 125,000 像素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

水平或垂直 WPF 线是否限制为 125,000 像素?查看以下代码,绿线显示正确,但红线尽管仅长 0.01,但根本不显示.知道为什么吗?

Are horizontal or vertical WPF Lines limited to 125,000 pixels? Looking at the following code the Green line displays correctly but the Red one does not display at all despite being just 0.01 longer. Any idea why?

<Window x:Class="DCView.Window11"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window11" Height="300" Width="300">
    <ScrollViewer>
        <Grid Width="150000">
            <Line X1="0" X2="125000.00" Y1="10" Y2="10" StrokeThickness="1" Stroke="Green"></Line>
            <Line X1="0" X2="125000.01" Y1="20" Y2="20" StrokeThickness="1" Stroke="Red"></Line>
        </Grid>     
    </ScrollViewer>
</Window>

安德鲁

推荐答案

这似乎是 WPF 处理矢量图形的一个限制.

This seems to be a limitation in WPF's handling of vector graphics.

为了使它更复杂,请尝试更改 StrokeThickness - 如果您将红线的 StrokeThickness1 设置为 2,它再次显示......直到你将长度增加到250000以上......然后它再次消失.

To make it more complicated, try changing the StrokeThickness - if you set the StrokeThickness of your red line from 1 to 2, it displays again... until you increase the length above 250000.. Then it vanishes again.

<Grid>
    <Line X1="0" X2="125000.00" Y1="10" Y2="10" StrokeThickness="1" Stroke="Green"></Line>
    <Line X1="0" X2="250000.00" Y1="20" Y2="20" StrokeThickness="2" Stroke="Red"></Line>
    <Line X1="0" X2="250000.01" Y1="30" Y2="30" StrokeThickness="2" Stroke="Blue"></Line>
</Grid>  

随着笔画粗细的增加,最大长度也会增加.

The max length goes up as you increase your stroke thickness.

另请注意,如果线条不是完全水平或垂直,长度限制似乎消失了:

Also Note that if the line wasn't perfectly horizontal or vertical, the length limit seems to vanish:

<Grid>
    <Line X1="0" X2="125000.00" Y1="10" Y2="10" StrokeThickness="1" Stroke="Green" />
    <Line X1="0" X2="125000.01" Y1="20" Y2="20.0001" StrokeThickness="1" Stroke="Red" />
</Grid>

您可以在连接上找到错误:消失路径(WPF)

You can find the bug written up on connect: Disappearing Path (WPF)

这篇关于水平或垂直 WPF 线限制为 125,000 像素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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