具有不同纯色的线条,带有渐变停止但没有渐变的纯色画笔

发布于 2024-07-29 20:12:52 字数 456 浏览 1 评论 0原文

在 Silverlight(版本 3 预览)中,我想创建一条具有不同纯色的线条,因此颜色之间没有渐变。

基本上我想做以下事情:

<Line X1="0" X2="500" StrokeThickness="10">
<Line.Stroke>
    <LinearGradientBrush>
        <GradientStop Color="Blue" Offset="0.5" />
        <GradientStop Color="Red" Offset="1"/>
    </LinearGradientBrush>
</Line.Stroke>
</Line>

但是随着颜色的离散变化,而不是从蓝色到红色的逐渐变化,

我想知道这是否可以在不诉诸使用多条线的情况下实现?

In Silverlight (version 3 preview), I want to create a Line with different solid colors, so no gradients between colors.

Basically I want to do the following:

<Line X1="0" X2="500" StrokeThickness="10">
<Line.Stroke>
    <LinearGradientBrush>
        <GradientStop Color="Blue" Offset="0.5" />
        <GradientStop Color="Red" Offset="1"/>
    </LinearGradientBrush>
</Line.Stroke>
</Line>

But with a discrete change in color, and not the gradual change from blue to red

I wonder if this is possible without resorting to using multiple lines?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

像极了他 2024-08-05 20:12:52

您正在寻找的是这样的:

<Line.Stroke>
    <LinearGradientBrush>
            <GradientStop Color="Blue" Offset="0.5" />
            <GradientStop Color="Red" Offset="0.5" />
     </LinearGradientBrush>
</Line.Stroke>

通过将停靠点设置在彼此之上,它们没有空间从一个过渡到另一个。

希望这可以帮助。

What you're looking for is this

<Line.Stroke>
    <LinearGradientBrush>
            <GradientStop Color="Blue" Offset="0.5" />
            <GradientStop Color="Red" Offset="0.5" />
     </LinearGradientBrush>
</Line.Stroke>

By setting the stops on top of each other they don't have space in which to transition from the one to the other.

Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文