Table of Contents
相关参考
Home Database Mysql Tutorial WPF 与Surface 2.0 SDK 亲密接触

WPF 与Surface 2.0 SDK 亲密接触

Jun 07, 2016 pm 03:20 PM
sdk surface wpf Will

本篇将为大家介绍如何使用ScatterView 控件实现上述功能。由于触屏技术只在Windows 7 操作系统中支持,所以XP 的用户必须要升级到Windows 7 系统。首先,需要在Windows 7 中安装Surface 2.0 SDK 和Runtime,可到官方页面下载安装程序。安装完成后打开VS2010

本篇将为大家介绍如何使用ScatterView 控件实现上述功能。由于触屏技术只在Windows 7 操作系统中支持,所以XP 的用户必须要升级到Windows 7 系统。首先,需要在Windows 7 中安装Surface 2.0 SDK 和Runtime,可到官方页面下载安装程序。安装完成后打开VS2010 新建一个Surface 2.0 项目。在模板中选择Surface Appliction(WPF)。

WPF 与Surface 2.0 SDK 亲密接触

     我们可以在当前的XAML 代码中添加一个Label 控件。F5 运行后Label 控件是无法进行Manipulating 操作的。

<span><span>s</span><span>:</span><span>SurfaceWindow </span><span>x</span><span>:</span><span>Class</span><span>="ScatterView.SurfaceWindow1"
    </span><span>xmlns</span><span>="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    </span><span>xmlns</span><span>:</span><span>x</span><span>="http://schemas.microsoft.com/winfx/2006/xaml"
    </span><span>xmlns</span><span>:</span><span>s</span><span>="http://schemas.microsoft.com/surface/2008"
    </span><span>Title</span><span>="ScatterView"
>
    <span>Grid</span><span>>
        <span>Label </span><span>Content</span><span>="Surface 2.0" </span><span>Foreground</span><span>="Fuchsia" </span><span>FontWeight</span><span>="Bold"/>
    </span><span>Grid</span><span>>
</span><span>s</span><span>:</span><span>SurfaceWindow</span><span>>
</span></span></span></span>
Copy after login
WPF 与Surface 2.0 SDK 亲密接触

     接下来在Grid 中添加一个ScatterView 控件。我们可以将ScatterView 认为是一个容器能够包含其他控件,并且这些控件均可以实现Manipulating 效果。例如,我们在ScatterView 中加入Rectangle、Label、SurfaceTextBox 三个控件。有些朋友可能会问Rectangle 为什么要放在ScatterViewItem 里?其实,所有在ScatterView 里的控件默认都会自动加入到ScatterViewItem,所以如果不需要特别设置可以将ScatterViewItem 控件省略。本例中我为了调整Rectangle 的减速数值就需要手动写出ScatterViewItem 控件,并调整Deceleration 参数。

<span><span>Grid</span><span>>
    <span>s</span><span>:</span><span>ScatterView </span><span>x</span><span>:</span><span>Name</span><span>="mainScatterView">
        <span>s</span><span>:</span><span>ScatterViewItem </span><span>Deceleration</span><span>="50">
            <span>Rectangle </span><span>Fill</span><span>="Green" </span><span>Width</span><span>="200" </span><span>Height</span><span>="100"/>
        </span><span>s</span><span>:</span><span>ScatterViewItem</span><span>>
        
        <span>Label </span><span>Content</span><span>="Surface 2.0" </span><span>Foreground</span><span>="Fuchsia" </span><span>FontWeight</span><span>="Bold"/>
        
        <span>s</span><span>:</span><span>SurfaceTextBox </span><span>Width</span><span>="500" </span><span>Height</span><span>="20" </span><span>FontSize</span><span>="20"/>
    </span><span>s</span><span>:</span><span>ScatterView</span><span>>
</span><span>Grid</span><span>>
</span></span></span></span></span></span></span>
Copy after login

完成上面代码后,F5 再运行一次。感觉如何?Manipulating 效果是不是变得很简单了... ...

WPF 与Surface 2.0 SDK 亲密接触

如果有需要可以自动加载控件到ScatterView,下面代码将自动加入一张本机图片到程序中。

<span>private void </span>AddDemoPic()
{
    <span>string </span>targetPic = <span>@"C:\Users\Public\Pictures\Sample Pictures\Koala.jpg"</span>;

    <span>ScatterViewItem </span>item = <span>new </span><span>ScatterViewItem</span>();
    mainScatterView.Items.Add(item);

    <span>MediaElement </span>pic = <span>new </span><span>MediaElement</span>();
    item.Content = pic;
    item.Background = <span>Brushes</span>.Transparent;

    <span>if </span>(System.IO.<span>File</span>.Exists(targetPic))
    {
        pic.Source = <span>new </span><span>Uri</span>(targetPic);
    }
    <span>else
    </span>{
        item.Content = <span>"Picture not found"</span>;
    }
}
Copy after login

WPF 与Surface 2.0 SDK 亲密接触

至此,本篇关于ScatterView 的介绍就到这里,欢迎大家相互交流。

相关参考

ScatterView Class

作者:李敬然(Gnie)
出处:{GnieTech} (http://www.cnblogs.com/gnielee/)

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Microsoft's Wireless Display Adapter is discontinued: Can Surface take up the slack? Microsoft's Wireless Display Adapter is discontinued: Can Surface take up the slack? Sep 08, 2023 pm 03:53 PM

According to news on September 8, Microsoft announced in April this year that it would stop producing and selling Microsoft-branded accessories, including mice, keyboards, and cameras, and would focus on Surface-branded computer accessories in the future. Not long ago, foreign technology media mspoweruser reported an update on Microsoft’s wireless display adapter. According to their reports, the Microsoft Wireless Display Adapter has been sold out in the Microsoft Store in the United States, and subsequent restocking seems unlikely. The Microsoft Wireless Display Adapter is a once-popular product that easily connects Miracast-compatible devices to HDTVs or monitors, allowing users to share their tablets, laptops, or smartphones.

Microsoft is developing new blur effects for Windows 11 Microsoft is developing new blur effects for Windows 11 May 13, 2023 am 09:04 AM

The new Windows 11 SDK for build 22523 revealed that Microsoft is developing a new blur effect for Windows 11. This effect is called Tabbed, and is in addition to Acrylic and Mica. The new DWMWA_SYSTEMBACKDROP_TYPE in the 22523 SDK, Mica, Acrylic’s public Win32 API and their weird new “tab” mix: pic.twitter.com/dbsu7ZFiIi — It’s All Back (@StartIsBack) December 15, 2021 Available in the following SDK’s Sample application

WPF tutorial from entry to proficiency WPF tutorial from entry to proficiency Oct 27, 2023 am 09:45 AM

WPF is a desktop application development framework based on the .NET Framework developed by Microsoft. It provides rich user interface elements, data binding, animation and other functions, allowing developers to easily create high-quality desktop applications.

Windows App SDK 1.2 is now online, here's what's new Windows App SDK 1.2 is now online, here's what's new May 12, 2023 pm 06:07 PM

The WindowsAppSDK is a set of tools and APIs that developers can use in their Windows applications to provide "consistent" functionality across a variety of devices using Windows 10 (version 1809 and later) and Windows 11. It's really important to understand that it doesn't replace existing application types like .NET or Windows SDK, it just provides a unified API toolset that can be used to complement your existing applications. Today, Microsoft released version 1.2 of Windows App SDK with many new features. The highlight of this release may be third-party developers

Master the essential skills for secondary development of Java Hikvision SDK Master the essential skills for secondary development of Java Hikvision SDK Sep 06, 2023 am 08:10 AM

Master the essential skills for secondary development of Java Hikvision SDK Introduction: With the rapid development of information technology, video surveillance systems have been widely used in various fields. As the leading domestic video surveillance solution provider, Hikvision’s products and technologies have always occupied an important position in the market. In order to meet the needs of different projects, Hikvision provides SDK for developers to carry out secondary development. This article will introduce some essential skills for mastering the secondary development of Java Hikvision SDK, and attach corresponding code examples. 1. Understand Hikvision

Reaching the end of five years of firmware updates, Microsoft ends support for Surface Pro 7 2-in-1 laptop this month Reaching the end of five years of firmware updates, Microsoft ends support for Surface Pro 7 2-in-1 laptop this month Feb 20, 2024 pm 02:27 PM

According to news from this site on February 20, after Microsoft stopped supporting Surface Pro (fifth generation) last month, it recently issued another reminder stating that it will stop supporting Surface Pro 7 on February 28, 2024 and will no longer push new firmware updates for it. Note from this site: Surface Pro 7 was released in 2019, using Intel’s 10th generation Core processor, with up to 16GB RAM and 1TB SSD options. This product supports fast charging and can last a whole day on a full charge. The official feature is the ready-to-use function, so you can continue working anytime and anywhere. The Surface Pro 7 has enjoyed regular firmware updates for nearly five years. After February 28, Microsoft will no longer push firmware updates to the device to fix specific issues related to the device.

what is sdk what is sdk Jan 06, 2023 pm 03:26 PM

The full name of sdk is "Software Development Kit", which means "software development kit" in Chinese. It is a set of tools provided by manufacturers of hardware platforms, operating systems (OS) or programming languages. SDKs assist software developers in creating applications for specific platforms, systems or programming languages. A basic SDK usually consists of a compiler, debugger, and application programming interface (API), but may also include other content, such as: documentation, libraries, runtime/development environment, testing/analysis tools, network protocols, etc.

See all articles