我可以为笔画添加边框吗? [英] Can I add a border to a stroke?

查看:81
本文介绍了我可以为笔画添加边框吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有些奇怪,但是我使用了非常粗的线条笔划(抚摸一条路径)来绘制弧形段形状。现在客户想要一个围绕'形状'的边框。我的直接想法是通过在它后面画一个稍宽的黑色笔划来伪造它。



然而,我很好奇。是否有正确的方法为行/笔划添加边框?

Somewhat bizarre I know, but I used a very thick line stroke (stroking a path) to draw an arc segment 'shape'. Now the client wants a border around the 'shape'. My immediate thought was to fake it by drawing a slightly wider black stroke behind it.

However, I'm curious. Is there a 'proper' way to add a border to a line/stroke?

推荐答案

您可以尝试这样做。此代码将为您提供行程的矩形边框。

You can try like this. This code will give you rectangular border to stroke.
<window x:class="WpfApplication3.MainWindow" xmlns:x="#unknown">
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" AllowsTransparency="True" WindowStyle="None" 
        Title="MainWindow" Height="406" Width="1076" Loaded="Window_Loaded" Background="Transparent" BorderBrush="White">
    <canvas height="346" width="1032" opacity="0.8">
          <border borderbrush="Black" borderthickness="1" horizontalalignment="Center" verticalalignment="Center"></border>
        <!--Non-Rectangular window edge, created with PathGeometry-->
            <path stroke="DarkGray" strokethickness="2" height="346" width="1032" opacity="0.9">
                <path.fill>
                    <lineargradientbrush startpoint=".2,0" endpoint="0.8,1">
                        <gradientstop color="Lightgray" offset="0"></gradientstop>
                        <gradientstop color="PaleGoldenrod" offset="1.0"></gradientstop>
                        <gradientstop color="AliceBlue" offset="0.4"></gradientstop>
                        <gradientstop color="LightGoldenrodYellow" offset="0.5"></gradientstop>
                    </lineargradientbrush>
                </path.fill>
                <path.data>
                    <pathgeometry>
                        <pathfigure startpoint="40,20" isclosed="True">
                            <linesegment point="990,20"></linesegment>
                            <arcsegment point="1020,50" size="40,55" sweepdirection="Clockwise"></arcsegment>
                            <linesegment point="1020,300"></linesegment>
                            <arcsegment point="990,330" size="40,55" sweepdirection="Clockwise"></arcsegment>
                            <linesegment point="40,330"></linesegment>
                            <arcsegment point="10,290" size="40,55" sweepdirection="Clockwise"></arcsegment>
                            <linesegment point="10,45"></linesegment>
                            <arcsegment point="40,20" size="40,55" sweepdirection="Clockwise"></arcsegment>
                        </pathfigure>
                    </pathgeometry>
                </path.data>
            </path>
        
       
    </canvas>
</window>


这篇关于我可以为笔画添加边框吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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