开发者

Is there any way to display Horizontal OR Vertical lines in Rectangle

Is there 开发者_StackOverflow中文版any way without using image to show horizontal or vertical lines in the Rectangle.


Yes you can easily do this with a LinearGradientBrush:

  <Rectangle Width="100" Height="100">
     <Rectangle.Fill>
        <LinearGradientBrush SpreadMethod="Reflect" StartPoint="0 0" EndPoint="0 0.05">
           <GradientStop Offset="0.5" Color="Black"/>
           <GradientStop Offset="0.5" Color="White"/>
        </LinearGradientBrush>
     </Rectangle.Fill>
  </Rectangle>

You control line thickness and orientation with the EndPoint property.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜