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)的更多相关文章
- WPF中Logical Tree和Visual Tree的区别
The Logical TreeThe logical tree describes the relations between elements of the user interface. The ...
- 【WPF学习】第四十五章 可视化对象
前面几章介绍了处理适量适中的图形内容的最佳方法.通过使用几何图形.图画和路径,可以降低2D图形的开销.即使正在使用复杂的具有分层效果的组合形状和渐变画刷,这种方法也仍然能够正常得很好. 然而,这样设计 ...
- WPF中的依赖项属性
Form cnblogs 桂素伟 随着WPF的推广,不得不重新拾起WPF来,因为这块的产品越来越多. 只能跟着MSDN来学了,所以想是在这里记录下学习的过程和对知识的理解. 先从最基本的吧,依赖项属性 ...
- WPF中的三维空间(1)
原文:WPF中的三维空间(1) WPF中可以创建三维几何图形,支持3D对象的应用,支持从3D Max等软件将3D文件obj导入设计中,但是目前还不支持将材质同时导入,这样需要在WPF中对3D对象重新设 ...
- WPF中的依赖项属性(转)
出处:https://www.cnblogs.com/axzxs2001/archive/2010/04/25/1719857.html 随着WPF的推广,不得不重新拾起WPF来,因为这块的产品越来越 ...
- 在 WPF 中使用 MahApps.Metro.IconPacks 提供的大量图标
MahApps.Metro.IconPacks https://github.com/MahApps/MahApps.Metro.IconPacks 提供了大量的高质量的图标供WPF使用,极其方便. ...
- WPF中实现图片文件转换成Visual对象,Viewport3D对象转换成图片
原文:WPF中实现图片文件转换成Visual对象,Viewport3D对象转换成图片 1.图片文件转换成Visual对象 private Visual CreateVisual(string imag ...
- WPF中的逻辑树和可视化树
WPF中的逻辑树是指XAML元素级别的嵌套关系,逻辑树中的节点对应着XAML中的元素. 为了方便地自定义控件模板,WPF在逻辑树的基础上进一步细化,形成了一个“可视化树(Visual Tree)”,树 ...
- WPF中的Visual Tree和Logical Tree与路由事件
1.Visual Tree和Logical TreeLogical Tree:逻辑树,WPF中用户界面有一个对象树构建而成,这棵树叫做逻辑树,元素的声明分层结构形成了所谓的逻辑树!!Visual Tr ...
随机推荐
- HDU 1248 寒冰王座 完全背包
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1248 中文题,大意就不说了. 第一道完全背包题,跟着背包九讲做的. 和0-1背包的区别在于所不同的是每种 ...
- 【例题5-2 UVA - 101】The Blocks Problem
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 用vector模拟就好. resize的时候,只是把多余的清理掉. 原先的不会变的. [错的次数] 在这里输入错的次数 [反思] 在 ...
- 云应用开发之新浪SAE读写云端数据库MySQL
本博文为前篇博文新浪云应用SAE日志查看的延续. 在读写云数据库MySQL之前,须要说明的是,在新浪云平台上使用数据库时.该平台默认会为每个应用单独新建一个数据库database实例.在该实例中再创建 ...
- stm32的dac
- eclipse去掉js验证
第一步:去除eclipse的js验证:window->preference->Java Script->Validator->Errors/Warnings->Enabl ...
- 如何查看一个网页特定效果的js代码(动画效果可js和css)(页面可以看到js的源代码)
如何查看一个网页特定效果的js代码(动画效果可js和css)(页面可以看到js的源代码) 一.总结 1.动画效果可能是 CSS 实现的,也可能是 JS 实现的. 2.直接Chrome的F12调试即可, ...
- js获取滚动条的宽度
function getScrollWidth() { var noScroll, scroll, oDiv = document.createElement("DIV"); oD ...
- erlang一些参考资源
1. erlang非业余研究 http://blog.yufeng.info/ 2.code.wang http://www.cnblogs.com/codew/ 3.码农生涯 http://www. ...
- 算法 Tricks(四)—— 获取一个数二进制形式第一个不为 0 的位置
int n = ...; int flag = 1; while ((flag & n) == 0) flag <<= 1; // & 运算时,其实判断的是二者的二进制形式 ...
- 灵活使用Excel可能会提高Java代码编写效率
使用Java操作数据时,当表字段太多时,书写实体类和进行实体类对象操作时都是一个繁重且易错的工作,光靠复制粘贴快捷键已不能满足负责的操作. 首先,说一下,就是在Eclipse中的快捷键,小写:ctrl ...