The following example shows the effect of the Pop command.

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation; namespace SDKSample
{ public class PopExample : Page
{ public PopExample()
{
Pen shapeOutlinePen = new Pen(Brushes.Black, 2);
shapeOutlinePen.Freeze(); // Create a DrawingGroup
DrawingGroup dGroup = new DrawingGroup(); // Obtain a DrawingContext from
// the DrawingGroup.
using(DrawingContext dc = dGroup.Open())
{
// Draw a rectangle at full opacity.
dc.DrawRectangle(Brushes.Blue, shapeOutlinePen, new Rect(0, 0, 25, 25)); // Push an opacity change of 0.5.
// The opacity of each subsequent drawing will
// will be multiplied by 0.5.
dc.PushOpacity(0.5); // This rectangle is drawn at 50% opacity.
dc.DrawRectangle(Brushes.Blue, shapeOutlinePen, new Rect(25, 25, 25, 25)); // Push an opacity change of 0.5.
// The opacity of each subsequent drawing will
// will be multiplied by 0.5. Note that
// push operations are cumulative (until they are
// popped).
dc.PushOpacity(0.5); // This rectangle is drawn at 25% opacity (0.5 x 0.5).
dc.DrawRectangle(Brushes.Blue, shapeOutlinePen, new Rect(50, 50, 25, 25)); // Changes the opacity back to 0.5.
dc.Pop(); // This rectangle is drawn at 50% opacity.
dc.DrawRectangle(Brushes.Blue, shapeOutlinePen, new Rect(75, 75, 25, 25)); // Changes the opacity back to 1.0.
dc.Pop(); // This rectangle is drawn at 100% opacity.
dc.DrawRectangle(Brushes.Blue, shapeOutlinePen, new Rect(100, 100, 25, 25));
} // Display the drawing using an image control.
Image theImage = new Image();
DrawingImage dImageSource = new DrawingImage(dGroup);
theImage.Source = dImageSource; this.Content = theImage; } } }

 

The following illustration shows this example's output:

DrawingContext.Pop Method的更多相关文章

  1. 最全数据结构详述: List VS IEnumerable VS IQueryable VS ICollection VS IDictionary

    本文对常用的数据结构详述:Array, ArrayList,List,IList,ICollection, Stack, Queue, HashTable, Dictionary, IQueryabl ...

  2. JAVA基础知识之Queue集合

    Queue接口 PriorityQueue类 Deque与ArrayDeque LinkedList 各种线性表性能分析 Queue接口 Queue用来模拟队列这种数据结构,遵循先进先出原则(FIFO ...

  3. js基础知识(pomelo阅读)

    0,node.js调试: http://www.noanylove.com/2011/12/node-the-inspector-debugging-node-js/   1,读取配置文件: var ...

  4. AssetBundle依赖关系

    原地址:http://www.cnblogs.com/realtimepixels/p/3652086.html Unity AssetBundle Dependencies In the last ...

  5. binary heap

    In computer science, a heap is a specialized tree-based data structure that satisfies the heap prope ...

  6. python之总体理解

    作为脚本,python具备了弱类型语言的灵活性,便捷性.这在日常的开发使用中能够大幅度的减轻开发人员的编码负担,开发者也能够将精力集中在程序的逻辑管理和总体构架设计上.一般而言,随着经验的积累,开发人 ...

  7. python之基本内容

    这里提供在使用python进行开发中常使用到的方法技巧,如有不对欢迎批评指正. 要点:开发中类.变量特性查询,类型就是类,断言的使用,深浅复制判断等 python脚本文件是使用UTF-8编码的,所以在 ...

  8. JavaScript设计模式(4)-桥接模式

    桥接模式 在设计一个 Js API 时,可用来弱化它与使用它的类和对象之间的耦合 1. 事件监听器的回调函数 function getBeerById(id, callback) { asyncReq ...

  9. flask 未完待续

    Flask - 一个短小精悍.可扩展的一个Web框架很多可用的第三方组件:http://flask.pocoo.org/extensions/blogs:https://www.cnblogs.com ...

随机推荐

  1. Java网络连接之HttpURLConnection 与 HttpClient

    HttpClient使用详解:http://blog.csdn.net/wangpeng047/article/details/19624529   注:HttpURLConnection输出流用ou ...

  2. Linux进程的前后台切换

    一.Linux前后台切换的相关命令:   1.&  在命令的后面加上这个符合,让命令进程在后台运行  例如: #ping 127.0.0.1 &        // 此时命令ping ...

  3. C#回顾 – 4.IEnumerable 集合

         

  4. MVC – 6.控制器 Action方法参数与返回值

      6.1 Controller接收浏览器数据   a.获取Get数据 : a1:获取路由url中配置好的制定参数: 如配置好的路由: 浏览器请求路径为: /User/Modify/1 ,MVC框架获 ...

  5. 与你相遇好幸运,Sail.js创建.sailsrc文件

    在项目根目录下创建.sailsrc文件 {  "generators": {    "modules": {}  },  "hooks": ...

  6. Shell编程基础教程7--脚本参数的传递

    7.脚本参数的传递    7.1.shift命令        简介:            shift n        每次将参数位置向左偏移n位        例子 #!/bin/bash us ...

  7. 无废话ExtJs 入门教程七[登陆窗体Demo:Login]

    无废话ExtJs 入门教程七[登陆窗体Demo:Login] extjs技术交流,欢迎加群(201926085) 在这节我们通过前几节讲的内容做一个登陆页面,把前几节讲的内容贯穿一下. 1.代码如下: ...

  8. php 接受处理二进制数据流并保存成图片

    <form action="提交到处理地址" method="post" enctype="multipart/form-data" ...

  9. hdu 4049 2011北京赛区网络赛J 状压dp ***

    cl少用在for循环里 #include<cstdio> #include<iostream> #include<algorithm> #include<cs ...

  10. ASP.NET 5 Beta8发布及升级经验

    (此文章同时发表在本人微信公众号"dotNET每日精华文章",欢迎右边二维码来关注.) 题记:ASP.NET 5 Beta8如期发布,这是一个重要的里程碑,因为这是ASP.NET ...