原文:使用VisualTreeHelper.GetDrawing(Visual v)枚举所有Visual内容的对象

C#代码:
public void RetrieveDrawing(Visual v)
{
    DrawingGroup dGroup = VisualTreeHelper.GetDrawing(v);
    EnumDrawingGroup(dGroup);
}

public void EnumDrawingGroup(DrawingGroup drawingGroup)
{
     DrawingCollection dc = drawingGroup.Children;

     foreach (Drawing drawing in dc)
     {
         // 如果是DrawingGroup,递归枚举
         if (drawing.GetType() == typeof(DrawingGroup))
         {
             EnumDrawingGroup((DrawingGroup)drawing);
         }
         else if (drawing.GetType() == typeof(GeometryDrawing))
         {
             // 处理代理
         }
         else if (drawing.GetType() == typeof(ImageDrawing))
         {
             // 处理代理
         }
         else if (drawing.GetType() == typeof(GlyphRunDrawing))
         {
             // 处理代理
         }
         else if (drawing.GetType() == typeof(VideoDrawing))
         {
             // 处理代理
         }
     }
}
 由于代码很简单,不赘述.

使用VisualTreeHelper.GetDrawing(Visual v)枚举所有Visual内容的对象的更多相关文章

  1. 使用Visual Leak Detector for Visual C++ 捕捉内存泄露

    什么是内存泄漏? 内存泄漏(memory leak),指由于疏忽或错误造成程序未能释放已经不再使用的内存的情况.内存泄漏并非指内存在物理上的消失,而是应用程序分配某段内存后,由于设计错误,失去了对该段 ...

  2. 解决Visual C++ Redistributable for Visual Studio 2015的安装问题

    1. Visual C++ Redistributable for Visual Studio 2015系统要求:Windows 7情况下必须是Windows 7 with SP1.或者Windows ...

  3. 彻底卸载Visual Studio 2013、Visual Studio 2015

    彻底卸载 Visual Studio 2013. Visual Studio 2015 以及后续各种版本使用方法0. 解压下载的 TotalUninstaller.zip 文件1. 使用 admini ...

  4. Visual.Studio.2013.IDE+visual.studio.15.preview5 编译器

    硬盘版Visual.Studio.2013.IDE + visual.studio.15.preview5 编译器 使用前注意以下事项: 1.右键-管理员权限安装,VS15补丁.exe,补丁是VS15 ...

  5. VS2017远程调试C#或 Visual Studio 中的 Visual Basic 项目

    来源:远程调试C#或 Visual Studio 中的 Visual Basic 项目 若要调试已部署在另一台计算机的 Visual Studio 应用程序,安装和在其中部署您的应用程序的计算机上运行 ...

  6. 如何使用 Visual C# 2005 或 Visual C# .NET 向 Excel 工作簿传输数据

    本文分步介绍了多种从 Microsoft Visual C# 2005 或 Microsoft Visual C# .NET 程序向 Microsoft Excel 2002 传输数据的方法.本文还提 ...

  7. 解决Visual C++ Redistributable for Visual Studio 2015的安装问题(摘录)

    1. Visual C++ Redistributable for Visual Studio 2015系统要求:Windows 7情况下必须是Windows 7 with SP1.或者Windows ...

  8. Create a Visual C++ Wizard for Visual Studio 2005

    from:http://www.codeguru.com/cpp/v-s/devstudio_macros/customappwizards/article.php/c12775/Create-a-V ...

  9. Visual C++ 2013 and Visual C++ Redistributable Package 更新版官网下载地址

    Visual C++ 2013 and Visual C++ Redistributable Visual C++ 2013 and Visual C++ Redistributable Packag ...

随机推荐

  1. vue学习笔记三:常见的表单绑定

    <template> <div id="app"> <input type="checkbox" id="checked ...

  2. [TypeStyle] Use fallback values in TypeStyle for better browser support

    You can increase the browser support of your CSS using fallback values and vendor prefixes. This les ...

  3. [RxJS] Hot Observable, by .share()

    .share() is an alias for .publish().refCount(). So if the source is not yet completed, no matter how ...

  4. [Swift] Storyboard outlet and action

    To programmaictlly change the content of app, we need to contect storyboard to a view controller. To ...

  5. ARM 授权费用太贵 科技巨头欲转向开源架构 RISC-V

    不久前,特斯拉加入 RISC-V 基金会,并考虑在新款芯片中使用免费的 RISC-V 设计.至此,已有 IBM.NXP.西部数据.英伟达.高通.三星.谷歌.华为等 100 多家科技公司加入 RISC- ...

  6. composer 安装 laravel 更换下载源

    1.在确认cmd 下载好composer 2. composer -V 3. composer config -g repo.packagist composer https://packagist. ...

  7. 【u032】均衡发展

    Time Limit: 1 second Memory Limit: 128 MB [问题描述] 神牛小R在许多方面都有着很强的能力,具体的说,他总共有m种能力,并将这些能力编号为1到m.他的能力是一 ...

  8. expdp之后scp的惊险时刻

    今天在导出数据的时候.忽然就想起了上次导数据的惊险时刻. 当时导出数据,有40g.分盘./backup有几T的空间,非常easy.果断搞! 是daochu.dmp,导出后传到还有一个主机,还有一个主机 ...

  9. 【计算机视觉】OpenCV中直方图处理函数简述

    计算直方图calcHist 直方图是对数据集合的统计 ,并将统计结果分布于一系列提前定义的bins中.这里的数据不只指的是灰度值 ,统计数据可能是不论什么能有效描写叙述图像的特征. 如果有一个矩阵包括 ...

  10. Oracle数据库的基本概念(转)

    一.数据库 我们在安装Oracle数据库时,全局数据库名:就是一个数据库的标识,在安装时就要想好,以后一般不修改,修改起来也麻烦,因为数据库一旦安装,数据库名就写进了控制文件,数据库表,很多地方都会用 ...