当前位置: 首页 > news >正文

Surface 2.0 SDK在WPF中应用

前提条件:Window7操作系统

好处:

没有使用Surface2.0之前,无论是简单的拖拽,还是复杂的旋转、缩放效果(下文简称Manipulating)都需要开发者逐字逐句的编写出来。Surface 2.0 SDK 的发布可以使这些工作更加简单,我们甚至不需要对这些效果写任何代码。

(1)下载安装Surface 2.0 SDK 和Runtime,下载地址

(2)安装成功后,在VS2010项目模板中会出现如下模板

r_surface4.jpg

(3)下面是做的一个例子,代码如下

<s:SurfaceWindow x:Class="SurfaceDemo.SurfaceWindow1"
xmlns
="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x
="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s
="http://schemas.microsoft.com/surface/2008"
Title
="SurfaceDemo"
>
<Grid >
<s:ScatterView x:Name="mainScatterView">
<Label Content="Surface 2.0" Foreground="Fuchsia" FontWeight="Bold"/>
<s:ScatterViewItem Width="300" Height="400">
<Image Height="400" HorizontalAlignment="Left" Name="image1" Stretch="Fill" Width="300" Source="/SurfaceDemo;component/images/027.jpg" />
</s:ScatterViewItem>
<s:ScatterViewItem Width="300" Height="400">
<Image Height="400" HorizontalAlignment="Left" Name="image2" Stretch="Fill" Width="300" Source="/SurfaceDemo;component/images/033.jpg" />
</s:ScatterViewItem>
<s:ScatterViewItem Width="300" Height="400">
<Image Height="400" HorizontalAlignment="Left" Name="image3" Stretch="Fill" Width="300" Source="/SurfaceDemo;component/images/028.jpg" />
</s:ScatterViewItem>
<s:ScatterViewItem Width="300" Height="400">
<Image Height="400" HorizontalAlignment="Left" Name="image4" Stretch="Fill" Width="300" Source="/SurfaceDemo;component/images/016.jpg" />
</s:ScatterViewItem>
<s:ScatterViewItem Width="300" Height="400">
<Image Height="400" HorizontalAlignment="Left" Name="image5" Stretch="Fill" Width="300" Source="/SurfaceDemo;component/images/1.jpg" />
</s:ScatterViewItem>
<s:ScatterViewItem Width="300" Height="400">
<Image Height="400" HorizontalAlignment="Left" Name="image6" Stretch="Fill" Width="300" Source="/SurfaceDemo;component/images/2.jpg" />
</s:ScatterViewItem>
<s:ScatterViewItem Width="300" Height="400">
<Image Height="400" HorizontalAlignment="Left" Name="image7" Stretch="Fill" Width="300" Source="/SurfaceDemo;component/images/3.jpg" />
</s:ScatterViewItem>
<s:SurfaceTextBox Width="500" Height="20" FontSize="20"/>
</s:ScatterView>
</Grid>
</s:SurfaceWindow>

注意点:ScatterView像一个空间容器,放在里面的控件都可以实现拖拽,缩放等操作,使用ScatterViewItem会更好些,作为ScatterView的每个想,也可以省略的,就先该列中Label就没有使用ScatterViewItem,使用ScatterViewItem可以控制拖放元素的长宽,不设置With,Height,会有一个默认的Width和Height,会影响相片的呈现效果

(4) 运行截图

r_surface1.png

本文参考自:李敬然 http://www.cnblogs.com/gnielee/archive/2011/07/14/wpf-surface2sdk-scatterview.html

相关文章:

  • 基于GNS3的独臂路由配置
  • DevExpress XtraReports 入门二 创建 data-aware(数据感知) 报表
  • Python基础之面向对象
  • C#加密汇总
  • 压缩打包介绍,gzip、bzip2、xz压缩工具
  • eclipse不能自动编译工程的解决方法
  • 普天发布新一代配线架,终结争论?
  • Server2008 安装 Zune
  • Asp.Net 开放式并发处理(和保守性并发)介绍
  • 如何在Windows XP上安装Windows Phone Developer Tools
  • 使用PowerShell配置IP地址
  • 基于jquery的常见函数封装
  • 理想
  • 物联网技术对智能远程医疗的影响
  • 帮助我了解Android2.2联系人结构(二)
  • [译] 理解数组在 PHP 内部的实现(给PHP开发者的PHP源码-第四部分)
  • 11111111
  • axios 和 cookie 的那些事
  • js写一个简单的选项卡
  • Node项目之评分系统(二)- 数据库设计
  • python 学习笔记 - Queue Pipes,进程间通讯
  • python学习笔记 - ThreadLocal
  • springMvc学习笔记(2)
  • 干货 | 以太坊Mist负责人教你建立无服务器应用
  • 测评:对于写作的人来说,Markdown是你最好的朋友 ...
  • $().each和$.each的区别
  • (17)Hive ——MR任务的map与reduce个数由什么决定?
  • (2020)Java后端开发----(面试题和笔试题)
  • (3)(3.2) MAVLink2数据包签名(安全)
  • (编程语言界的丐帮 C#).NET MD5 HASH 哈希 加密 与JAVA 互通
  • (带教程)商业版SEO关键词按天计费系统:关键词排名优化、代理服务、手机自适应及搭建教程
  • (二)什么是Vite——Vite 和 Webpack 区别(冷启动)
  • (附源码)ssm高校社团管理系统 毕业设计 234162
  • (附源码)计算机毕业设计大学生兼职系统
  • (更新)A股上市公司华证ESG评级得分稳健性校验ESG得分年均值中位数(2009-2023年.12)
  • (十二)springboot实战——SSE服务推送事件案例实现
  • (一)u-boot-nand.bin的下载
  • .bat批处理(五):遍历指定目录下资源文件并更新
  • .NET Core WebAPI中封装Swagger配置
  • .NET Core 中的路径问题
  • .NET 设计模式—简单工厂(Simple Factory Pattern)
  • .NET/C# 中你可以在代码中写多个 Main 函数,然后按需要随时切换
  • .Net转Java自学之路—基础巩固篇十三(集合)
  • .sys文件乱码_python vscode输出乱码
  • /etc/sudoers (root权限管理)
  • [] 与 [[]], -gt 与 > 的比较
  • [ACM] hdu 1201 18岁生日
  • [BZOJ 4034][HAOI2015]T2 [树链剖分]
  • [BZOJ 4129]Haruna’s Breakfast(树上带修改莫队)
  • [C#]科学计数法(scientific notation)显示为正常数字
  • [C语言][PTA基础C基础题目集] strtok 函数的理解与应用
  • [ffmpeg] 定制滤波器
  • [hdu 1711] Number Sequence [kmp]
  • [java]删除数组中的某一个元素
  • [leetcode]Flatten Binary Tree to Linked List