原文:WPF中的可视化对象(Visual)

这是MSDN对Visual的解释:
Visual class:
Provides rendering support in WPF, which includes hit testing, coordinate transformation, and bounding box calculations.

下面是关于Visual类的继承关系图,它清楚地表明了相关的层次关系:
System.Object
        System.Windows.Threading.DispatcherObject
                System.Windows.DependencyObject
                        System.Windows.Media.Visual
                                System.Windows.Media.ContainerVisual (支持包含其他Visual对象)
                                        System.Windows.Media.DrawingVisual
                                        System.Windows.Media.HostVisual
                                System.Windows.UIElement
                                        System.Windows.FrameworkElement
                                                System.Windows.Documents.Adorner
                                                System.Windows.Documents.AdornerLayer
                                                System.Windows.Documents.DocumentReference
                                                System.Windows.Documents.FixedPage
                                                System.Windows.Documents.Glyphs
                                                System.Windows.Documents.PageContent
                                                System.Windows.Interop.HwndHost
                                                Microsoft.Windows.Themes.ScrollChrome
                                                Microsoft.Windows.Themes.BulletChrome
                                                Microsoft.Windows.Themes.ScrollChrome
                                                System.Windows.Controls.Panel
                                                System.Windows.Controls.Control
                                                System.Windows.Controls.AccessText
                                                System.Windows.Controls.AdornedElementPlaceholder
                                                System.Windows.Controls.Decorator
                                                System.Windows.Controls.ContentPresenter
                                                System.Windows.Controls.Image
                                                System.Windows.Controls.InkCanvas
                                                System.Windows.Controls.ItemsPresenter
                                                System.Windows.Controls.MediaElement
                                                System.Windows.Controls.Page
                                                System.Windows.Controls.TextBlock
                                                System.Windows.Controls.ToolBarTray
                                                System.Windows.Controls.Viewport3D
                                                System.Windows.Shapes.Shape
                                                System.Windows.Controls.Primitives.GridViewRowPresenterBase
                                                System.Windows.Controls.Primitives.DocumentPageView
                                                System.Windows.Controls.Primitives.Popup
                                                System.Windows.Controls.Primitives.TickBar
                                                System.Windows.Controls.Primitives.Track
                                System.Windows.Media.Media3D.Viewport3DVisual 

再简洁点:
System.Object
        System.Windows.Threading.DispatcherObject
                System.Windows.DependencyObject
                        System.Windows.Media.Visual
                                System.Windows.Media.ContainerVisual
                                System.Windows.UIElement
                                        System.Windows.FrameworkElement
                                System.Windows.Media.Media3D.Viewport3DVisual

Visual:是WPF中用以呈现点击测试(与一个点、矩形、区域或其它对象之间执行像素级的点击检测,比如判断鼠标是否在一个对象内等),坐标转换和计算可视化对象尺寸范围的类。

以下是Visual,UIElement,FrameworkElement的构造示意:
public abstract class Visual : DependencyObject
public class UIElement : Visual, IAnimatable, IInputElement
public class FrameworkElement : UIElement, IFrameworkInputElement, IInputElement, ISupportInitialize

从Visual的构造看,它是继承于DependencyObject的抽像类。
而UIElement继承自Visual,FrameworkElement又继承自UIElement。

Visual是所有FrameworkElement的抽象基类。它为在WPF中写新的控件提供了入口点,在许多方面,你可以把它想像成为相当于Win32应用程序模式下的window句柄(HWND)。
Visual对象是WPF的核心对象,其主要角色是提供呈现支持。用户控件,如按钮Button和文本框TextBox,都从Visual类继承,并使用Visual定义的属性来维持它们的呈现数据。

Visual对象支持:
输入显示: 显示可视化的内容。
变换: 对可视化对象进行变换(比如尺寸变换、坐标转换等)。
裁切: 对可视化对象在裁切区域进行裁切之后显示。
点击测试(Hit testing):  检测一个指定的坐标(点)或几何对象是否在指定的可视化对象之范围内。
矩形范围计算:  确定Visual对象所涵盖的矩形区域。

架构上,Visual对象不支持包括其他应用程序开发需要的其他WPF特性:如:事件处理、版面布局、样式、数据绑定、全球化。

WPF中的可视化对象(Visual)的更多相关文章

  1. WPF中Logical Tree和Visual Tree的区别

    The Logical TreeThe logical tree describes the relations between elements of the user interface. The ...

  2. 【WPF学习】第四十五章 可视化对象

    前面几章介绍了处理适量适中的图形内容的最佳方法.通过使用几何图形.图画和路径,可以降低2D图形的开销.即使正在使用复杂的具有分层效果的组合形状和渐变画刷,这种方法也仍然能够正常得很好. 然而,这样设计 ...

  3. WPF中的依赖项属性

    Form cnblogs 桂素伟 随着WPF的推广,不得不重新拾起WPF来,因为这块的产品越来越多. 只能跟着MSDN来学了,所以想是在这里记录下学习的过程和对知识的理解. 先从最基本的吧,依赖项属性 ...

  4. WPF中的三维空间(1)

    原文:WPF中的三维空间(1) WPF中可以创建三维几何图形,支持3D对象的应用,支持从3D Max等软件将3D文件obj导入设计中,但是目前还不支持将材质同时导入,这样需要在WPF中对3D对象重新设 ...

  5. WPF中的依赖项属性(转)

    出处:https://www.cnblogs.com/axzxs2001/archive/2010/04/25/1719857.html 随着WPF的推广,不得不重新拾起WPF来,因为这块的产品越来越 ...

  6. 在 WPF 中使用 MahApps.Metro.IconPacks 提供的大量图标

    MahApps.Metro.IconPacks https://github.com/MahApps/MahApps.Metro.IconPacks 提供了大量的高质量的图标供WPF使用,极其方便. ...

  7. WPF中实现图片文件转换成Visual对象,Viewport3D对象转换成图片

    原文:WPF中实现图片文件转换成Visual对象,Viewport3D对象转换成图片 1.图片文件转换成Visual对象 private Visual CreateVisual(string imag ...

  8. WPF中的逻辑树和可视化树

    WPF中的逻辑树是指XAML元素级别的嵌套关系,逻辑树中的节点对应着XAML中的元素. 为了方便地自定义控件模板,WPF在逻辑树的基础上进一步细化,形成了一个“可视化树(Visual Tree)”,树 ...

  9. WPF中的Visual Tree和Logical Tree与路由事件

    1.Visual Tree和Logical TreeLogical Tree:逻辑树,WPF中用户界面有一个对象树构建而成,这棵树叫做逻辑树,元素的声明分层结构形成了所谓的逻辑树!!Visual Tr ...

随机推荐

  1. HDU 1215 七夕节 数学题~

    http://acm.hdu.edu.cn/showproblem.php?pid=1215 题目大意: 找对象的题...汗..将你的编号(唯一)的所有因子加起来,所得到的的另一个编号的主人就是你的另 ...

  2. stm32的ADC规则组通道采样顺序设置

    先看一下固件库手册 再看一下手册上的例子:  有两个通道,,并且顺序如下

  3. 【record】9.24..10.1

    因为参加比赛所以做得比较少了

  4. swift学习第一天:认识swift以及swift的常量和变量

    一:认识swift // 1.导入框架 //#import <UIKit/UIKit.h> import UIKit // 2.定义一个标识符 // int a = 10; // swif ...

  5. 《大型网站技术架构》1:概述 分类: C_OHTERS 2014-05-07 20:40 664人阅读 评论(0) 收藏

    参考自<大型网站技术架构>第1~3章 1.大型网站架构演化发展历程 (1)初始阶段的网站架构:一台服务器分别作为应用.数据.文件服务器 (2)应用服务和数据服务分离:三台服务器分别承担上述 ...

  6. 访问sharepoint站点自动使用当前用户名和密码登录

    https://blog.csdn.net/zw_2011/article/details/7417123 1.把sharepoint站点添入可信站点.   点击菜单栏“工具”——〉“Internet ...

  7. [转载]Surging教学视频资源汇总

    surging是什么 surging 是一个分布式微服务框架,提供高性能RPC远程服务调用,采用Zookeeper.Consul作为surging服务的注册中心,集成了哈希,随机,轮询.压力最小优先作 ...

  8. Android JNI编程(一)——JNI概念以及C语言Dev-C++开发环境搭建、编写HelloWorld

    版权声明:本文出自阿钟的博客,转载请注明出处:http://blog.csdn.net/a_zhon/. 目录(?)[+] 一:JNI是什么呢? JNI:JNI是JavaNative Interfac ...

  9. 使用jquery-validationEngine框架,4步实现前端JS校验

    第1步: 引入CSS和JS      <script type="text/javascript" src="${base}/static/js/frontback ...

  10. Mysql存储过程中使用cursor

    一.表 学生表 CREATE TABLE `t_student` (    `stuNum` int(11) NOT NULL auto_increment,    `stuName` varchar ...