How to use the right-click event and scroll event in the yinguangzhi silverlight4.0 tutorial

Source: Internet
Author: User
Tags visual studio 2010

Microsoft released Silverlight 4 Beta on pdc2009. Microsoft processed requests from about 8000 Silverlight end users in Silverlight 4 and added a series of exciting new features from other developers, the most prominent aspects are as follows:

Development Tool enhancement: Visual Studio 2010 has a visual design tool. When creating a project, you can choose whether the runtime version is 3.0 or 4.0, blend4 is added to the XAML and C # code comprehensive smart sensing functions, and the style application of XAML is easier to use.

Camera and MIC hardware support: a very small amount of code can be used to enable webcam and mic on the user's local machine, and local recording can be performed.

Report printing support: the problem of report printing is well solved in silverlight4.

More powerful basic controls (RichTextBox and DataGrid enhanced edition): Rich Text controls RichTextBox and DataGrid with the pasting and sorting functions are added.

WCF enhancement: TCP communication is finally supported, which is 3-5 times higher than HTTP, limited to ipv2-4534 ports.

Enhanced compatibility: Google Chrome browser support.

MEF support: MEF is called the managed extensibility framework. It is translated as "managed extension framework" and supports creating large and complex applications.

Improved Running Speed: the startup speed and rendering speed are about two times higher than the previous version.

DRM enhancement: playready is supported, which can protect video and audio playback and supplement H.264 DRM protection.

Other enhancements: support for local file read/write, right-click event, and clipboard cutting.

Two practical events are added to the mouse events in silverlight4, namely, right-click events and wheel events (also called pulley events ).

The right-click event includes: mouserightbuttondown mouserightbuttonup

Scroll wheel events include: mousewheel

When we operate some applications on a daily basis, the right-click menu is mostly used to display a pop-up menu. The menu is usually displayed at the same position when you click the mouse, scroll wheel events can often be used to change the zoom size of text or images when we browse webpages. Based on the two common operations above, we create a right-click menu and scroll wheel zoom function of the Silverlight version. First, we will make a simple interface layout.

XAML:

1 <grid X: Name = "layoutroot"
2 background = "black">
3 <image X: Name = "IMG" rendertransformorigin = "0.5, 0.5"
4 Source = "images/avatar_8.jpg" stretch = "fill">
5 <image. rendertransform>
6 <scaletransform X: Name = "St"/>
7 </image. rendertransform>
8 </image>
9 <textblock X: Name = "tbtip"
10 fontsize = "12"
11 fontfamily = "simsun"
12 text = "hello, please use the scroll wheel to adjust the image size"
13 foreground = "white" margin = "5"/>
14 <ListBox X: Name = "lstmenu" width = "150" Height = "260"
15 horizontalalignment = "left"
16 verticalalignment = "TOP">
17 </ListBox>
18 </GRID>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.