填充 xaml 矩形倍数 solidcolorbrush [英] Fill xaml rectangle multiples solidcolorbrush

查看:24
本文介绍了填充 xaml 矩形倍数 solidcolorbrush的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

xaml 中的这种填充矩形是否可行?

This type of fill in rectangle in xaml is it possible?

我不想使用渐变来填充矩形,因为在每个部分的图像中使用纯色刷不同.

I don't want to use gradient to fill the rectangle, as in the image per section using solid colorbrush different.

谢谢

推荐答案

试试这个:

<Rectangle Width="300" Height="100" Stroke="black" StrokeThickness="3">
  <Rectangle.Fill>
    <LinearGradientBrush StartPoint="0 0" EndPoint="1 0">
      <GradientStop Color="red" Offset="0"/>
      <GradientStop Color="red" Offset=".33"/>
      <GradientStop Color="black" Offset=".33"/>
      <GradientStop Color="black" Offset=".34"/>
      <GradientStop Color="green" Offset=".34"/>
      <GradientStop Color="green" Offset=".66"/>
      <GradientStop Color="black" Offset=".66"/>
      <GradientStop Color="black" Offset=".67"/>
      <GradientStop Color="cyan" Offset=".67"/>
    </LinearGradientBrush>
  </Rectangle.Fill>
</Rectangle>

这篇关于填充 xaml 矩形倍数 solidcolorbrush的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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