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 ...
随机推荐
- MM常用的双关语(男士必读)
我们还是当朋友好了 (其实你还是有多馀的利用价值)我想我真的不适合你(我根本就不喜欢你.)天气好冷喔,手都快结冰了 (快牵我的手吧,大木头!)我觉得我需要更多一点的空间 (我不太想看到你啦!)其实你人 ...
- 【19.77%】【codeforces 570D】Tree Requests
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- hibernate---java.lang.UnsupportedOperationException: The user must supply a JDBC connection
在配置hibernate时.运行代码时一直抛错: Exception in thread "main" java.lang.UnsupportedOperationExce ...
- 美国汪利宏的蒙特卡洛及卷积模拟程序,可以模拟top-hat光束和高斯光束在生物组织中的传输
链接:https://pan.baidu.com/s/1yaCsQ8TCVPSIZ4TVBZgfnw 密码:otzr
- thinkphp5 tp5 获取模块名控制器名方法名
<?php namespace app\index\controller; use think\Db; use think\Controller; class Base extends Cont ...
- Android学习笔记:Home Screen Widgets(2):关于Widget
通过widget定义,我们在widget列表中看到了我们的TestWidget.当我们拖拽widget到主页时,假设在appwidet-provider中定义了android:configure的ja ...
- iOS开发Quartz2D 十三:画板涂鸦
一:效果如图: 二:代码 #import "ViewController.h" #import "DrawView.h" #import "Handl ...
- jquery-10 jquery中的绑定事件和解绑事件的方法是什么
jquery-10 jquery中的绑定事件和解绑事件的方法是什么 一.总结 一句话总结:bind(); unbind(); one(); 1. jquery中的绑定事件和解绑事件的方法是什么? bi ...
- Ubuntu 16.04下安装Anaconda
1.下载Anaconda到系统 官网:https://www.anaconda.com/download/ 清华大学开源软件镜像站:https://mirrors.tuna.tsinghua.edu. ...
- HttpServletRequest方法
HttpServletRequest HttpServletRequest对象代表客户端的请求,当客户端通过HTTP协议访问服务器时,HTTP请求头中的所有信息都封装在这个对象中,开发人员通过这个对象 ...