WPF - 我怎样才能使一个刷子绘制图的纸状的广场?刷子、能使、广场、WPF

由网友(被风吹过灼思)分享简介:如何可以创建一个画笔描绘了1个单位粗线有规律的,重复的网格均匀隔开在水平和垂直轴?想象一下,方格纸,如果你愿意。How might I create a brush that paints a regular, repeated grid of 1-unit thick lines spaced evenly in...

如何可以创建一个画笔描绘了1个单位粗线有规律的,重复的网格均匀隔开在水平和垂直轴?想象一下,方格纸,如果你愿意。

How might I create a brush that paints a regular, repeated grid of 1-unit thick lines spaced evenly in both the horizontal and vertical axes? Imagine graph paper, if you will.

理想情况下,解决方案将允许在用于行和背景(用方框中的区域)的刷子控制。以这种方式,背景可以是透明的,以便网格可作为一个覆盖

Ideally the solution would allow control over the brushes used for the lines and the background (the regions within the squares). In this way the background could be transparent, so that the grid could serve as an overlay.

修改这里是一个图像,显示低于汤姆的回答结果:

EDIT Here is an image that shows the result of Tom's answer below:

有关本实施例的栅格被用来复合三层表明网格是真正透明

For this example a grid was used to composite three layers to show that the grid is truly transparent.

推荐答案

从http://msdn.microsoft.com/en-us/library/aa480159.aspx

<DrawingBrush Viewport="0,0,10,10" 
              ViewportUnits="Absolute"
              TileMode="Tile">
  <DrawingBrush.Drawing>
    <DrawingGroup>
      <GeometryDrawing Geometry="M0,0 L1,0 1,0.1, 0,0.1Z" Brush="Green" />
      <GeometryDrawing Geometry="M0,0 L0,1 0.1,1, 0.1,0Z" Brush="Green" />
    </DrawingGroup>
  </DrawingBrush.Drawing>
</DrawingBrush>
阅读全文

相关推荐

最新文章