WPF,SilverLight中直线的样式示例
XAML代码:
// LineStyle.xaml
<Viewbox Width="600" Height="500"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Canvas Width="600" Height="500">
<Canvas.Resources>
<DrawingBrush x:Key="MyGridBrushResource1" Viewport="0,0,100,100" ViewportUnits="Absolute" TileMode="Tile">
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<!--横线-->
<GeometryDrawing Geometry="M0,1 L10,1 M0,2 L10,2 M0,3 L10,3 M0,4 L10,4 M0,5 L10,5 M0,6 L10,6 M0,7 L10,7 M0,8 L10,8 M0,9 L10,9">
<GeometryDrawing.Pen>
<Pen Thickness="0.1" Brush="#CCCCFF" />
</GeometryDrawing.Pen>
</GeometryDrawing>
<!--竖线-->
<GeometryDrawing Geometry="M1,0 L1,10 M2,0 L2,10 M3,0 L3,10 M4,0 L4,10 M5,0 L5,10 M6,0 L6,10 M7,0 L7,10 M8,0 L8,10 M9,0 L9,10">
<GeometryDrawing.Pen>
<Pen Thickness="0.1" Brush="#CCCCFF" />
</GeometryDrawing.Pen>
</GeometryDrawing>
<!-- 这里是横线 -->
<GeometryDrawing Geometry="M0,0 L10,0">
<GeometryDrawing.Pen>
<Pen Thickness="0.1" Brush="DarkOrange" />
</GeometryDrawing.Pen>
</GeometryDrawing>
<!-- 这里是竖线 -->
<GeometryDrawing Geometry="M0,0 L0,10">
<GeometryDrawing.Pen>
<Pen Thickness="0.1" Brush="DarkOrange" />
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
<!-- 这里是外框线 -->
<Style x:Key="MyGridBorderStyle">
<Setter Property="Border.Background" Value="{StaticResource MyGridBrushResource1}"/>
<Setter Property="Border.HorizontalAlignment" Value="Center"/>
<Setter Property="Border.VerticalAlignment" Value="Top"/>
<Setter Property="Border.BorderBrush" Value="Black"/>
<Setter Property="Border.BorderThickness" Value="1"/>
</Style>
</Canvas.Resources>
<Border Style="{StaticResource MyGridBorderStyle}">
<Canvas Width="630" Height="400">
<Line Stroke="Black" X1="0" Y1="20" X2="400" Y2="20" StrokeDashArray="1,1" StrokeThickness="30"/>
<Line Stroke="Black" X1="0" Y1="60" X2="400" Y2="60" StrokeDashArray="1,1,2" StrokeThickness="30" />
<Line Stroke="Black" X1="0" Y1="100" X2="400" Y2="100" StrokeDashArray="1,1,2,2"
StrokeThickness="30" StrokeDashCap="Round" StrokeStartLineCap="Round" StrokeEndLineCap="Round" />
<Line Stroke="Black" X1="0" Y1="140" X2="400" Y2="140" StrokeDashArray="1,1,2,2" StrokeThickness="30"
StrokeStartLineCap="Round" StrokeEndLineCap="Round" />
<Line Stroke="Black" X1="0" Y1="180" X2="400" Y2="180" StrokeDashArray="0,1"
StrokeThickness="30" StrokeDashCap="Round" StrokeStartLineCap="Round" StrokeEndLineCap="Round" />
<Line Stroke="Black" X1="0" Y1="220" X2="400" Y2="220" StrokeDashArray="0,2" StrokeThickness="30"
StrokeDashCap="Round" StrokeStartLineCap="Round" StrokeEndLineCap="Round" />
<Line Stroke="Black" X1="0" Y1="260" X2="400" Y2="260" StrokeDashArray="0,2,0,2" StrokeThickness="30"
StrokeDashCap="Round" StrokeStartLineCap="Round" StrokeEndLineCap="Round" />
<Line Stroke="Black" X1="0" Y1="300" X2="400" Y2="300" StrokeDashArray="0,1,1" StrokeThickness="30"
StrokeDashCap="Round" StrokeStartLineCap="Round" StrokeEndLineCap="Round" />
<Line Stroke="Black" X1="0" Y1="340" X2="400" Y2="340" StrokeDashArray="0,2,1,0" StrokeThickness="30"
StrokeDashCap="Round" StrokeStartLineCap="Round" StrokeEndLineCap="Round" />
</Canvas>
</Border>
</Canvas>
</Viewbox>
运行效果:
WPF,SilverLight中直线的样式示例的更多相关文章
- WPF/Silverlight中图形的平移,缩放,旋转,倾斜变换演示
原文:WPF/Silverlight中图形的平移,缩放,旋转,倾斜变换演示 为方便描述, 这里仅以正方形来做演示, 其他图形从略. 运行时效果图:XAML代码:// Transform.XAML< ...
- WPF/Silverlight中的RichTextBox总结
WPF/Silverlight中的RichTextBox总结 在WPF或者是在Silverlight中有个非常强大的可以编辑的容器控件RichTextBox,有的时间会采取该控件来作为编辑控件.鉴 ...
- WPF/Silverlight Template使用及总结(转)
WPF/Silverlight 中的控件都有Style和Template两种属性.前者解释为样式,是用来改变控件原有属性的,比如 Button 控件的(Width,Height,Background ...
- WPF/Silverlight深度解决方案:(一)解锁被Storyboard束缚的关联属性
原文 WPF/Silverlight深度解决方案:(一)解锁被Storyboard束缚的关联属性 如果您在使用WPF/Silverlight进行相关动画开发中使用了Storyboard,并对关联属性进 ...
- wpf将表中数据显示到datagrid示例(转)
原文:http://www.jb51.net/article/47120.htm 这篇文章主要介绍了wpf将表中数据显示到datagrid示例,需要的朋友可以参考下 a.在.xaml文件中拖入一个da ...
- WPF/Silverlight深度解决方案:(七)HLSL自定义渲染特效之完美攻略(中)
原文:WPF/Silverlight深度解决方案:(七)HLSL自定义渲染特效之完美攻略(中) 通过上一节的解说,大家是否已经对HLSL有了较深刻的认识和理解,HLSL的渲染不仅仅局限于静态处理,通过 ...
- 浅谈WPF本质中的数据和行为
WPF缩写为Windows Presentation Foundation的缩写,本文所要谈的就是WPF本质中的数据和行为,希望通过本文能对大家了解WPF本质有所帮助. 如果自己来做一个UI框架,我们 ...
- Silverlight中的TabControl如何绑定数据?重写tabcontrol和tabItem 解决绑定友好问题。可以绑定对象集合
在 WPF 中,TabControl 可以直接将 ItemsSource 绑定数据源,见 将 TabControl 绑定到数据的示例 http://msdn.microsoft.com/zh-cn/l ...
- WPF/Silverlight HierarchicalDataTemplate 模版的使用(转)
上一篇 对Wpf/Silverlight Template 进行了总结,本篇继续上一篇,主要是介绍 HierarchicalDataTemplate 的使用方法.HierarchicalDataTem ...
随机推荐
- Snail—Hibernate之自写固定组件
Hibernate的存储都是在session中进行的,此session非彼session 以下就是从生成的Hibernate配置文件获得连接数据库,然后再得到session等等 package com ...
- [AngularFire 2] Object Observables - How to Read Objects from a Firebase Database?
In this lesson we are going to learn how to use AngularFire 2 to query objects, and read them from t ...
- Java RMI使用
1. Java RMI介绍 RMI:远程方法调用(Remote Method Invocation).能够让在某个java虚拟机上的对象像调用本地对象方法一样调用另一个java 虚拟机中的对象上的方法 ...
- 【微信小程序】自定义模态框实例
原文链接:https://mp.weixin.qq.com/s/23wPVFUGY-lsTiQBtUdhXA 1 概述 由于官方API提供的显示模态弹窗,只能简单地显示文字内容,不能对对话框内容进行自 ...
- [Redis专辑][1]ubuntu12.04下安装php-redis的方法和步骤
首次公布路径:phpredis的安装 非常久非常久没有写博文了,好多博文都没有整理完成,今天才抽时间整理完这一篇博文,希望能对大家有一定的帮助 首先对redis做个简单的介绍: Redis 是全然开源 ...
- chain rule 到 Markov chain
1. 联合概率(joint distribution)的链式法则 基于链式法则的 explicit formula: p(x1:n)===p(x)p(x1)∏i=2np(xi|x1,-,xi−1)∏i ...
- 【77.78%】【codeforces 625C】K-special Tables
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- URL validation failed. The error could have been caused through the use of the browser's navigation
URL validation failed. The error could have been caused through the use of the browser's navigation ...
- [Angular] Using InjectionToken
Previously we have 'OpaqueToken', but it is DEPRECATED. The new one is called 'InjectionToken'. The ...
- 卸载、指定卸载 .NET Core Runtime and SDK
原文:卸载.指定卸载 .NET Core Runtime and SDK 项目使用的 Nuget 包,比如 Microsoft.AspNetCore.App等的版本号要与 .NET Core 版本号( ...