使用 Blend 来创建一个不规则 Border
时间:2010-01-23
来源:互联网
设我们有一个空白项,对应的Xaml文件为: <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="SilverlightApplication4.MainPage" Width="640" Height="480"> <Grid x:Name="LayoutRoot" Background="White"/> UserControl>我们在其中增加一个 Border 控件,并用 钢笔或者铅笔画一个不规则图形。 这时候,产生的Xaml 文件类似如下:<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="SilverlightApplication4.MainPage" Width="640" Height="480"> <Grid x:Name="LayoutRoot" Background="White"> <Border Height="115" Margin="103,47,102,0" VerticalAlignment="Top" BorderBrush="Black" BorderThickness="1"> <Path Fill="White" Stretch="Fill" Stroke="Black" Margin="73.5,35.598,149.5,12.5" UseLayoutRounding="False" Data="M83,46 C228,18 284,65 284,65 L217,100.99988 L177,79.999947 L141,93.999901 L75,76.999962 z"/> Border> Grid> UserControl>然后我们在“对象和时间线中”选择我们要用的Path 对象,如下图: 点击 路径 --》 生成剪切路径在出现的 生成剪切路径选择窗口中,我们选择需要使用这个路径的对象,这里我们选择“Border” 对象 点击确定后,我们就可以获得一个不规则的 Border, 这时候的Xaml 文件为:<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="SilverlightApplication4.MainPage" Width="640" Height="480"> <Grid x:Name="LayoutRoot" Background="White"> <Border Height="115" Margin="103,47,102,0" VerticalAlignment="Top" BorderBrush="Black" BorderThickness="1" Clip="M83,45.999935 C228,17.999838 284,65 284,65 L217,101 L177,80 L141,94 L75,77 z"/> Grid> UserControl>适当调整颜色后,看到的Border 就是如下图: 其他控件我们想要设计成不规则方式, 在Blend 中的设计步骤类似 转自:http://bbs.flatws.cn/thread-10606-1-1.html |
作者: swlyb 发布时间: 2010-01-23
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28