Learning Windows phone 7 development together (IV. DeepZoom)

Source: Internet
Author: User

DeepZoom is a special feature of silverlight and is also added to windows phone 7. This function is now the main function of the phone7 Ui. Because many of the Ui of phone7 was developed by DeepZoom, And the cartoon reading software exhibited at the MIX10 conference was also developed by DeepZoom. We can also see the importance of this function on phone7.

 

1. To develop DeepZoom, you first need DeepZoom Composer, a tool in expression, to generate the deepzoom Gallery.

 

2. Create a windows phone application and add the following statement in the xaml design window:

<MultiScaleImage x: Name = "msi" Width = "486" Height = "652" verticalignment = "Top" HorizontalAlignment = "Left" Margin = "-,"/>

In Phone7, you can only use MultiScaleImage to display the DeepZoom Gallery.

 

3. Add the gallery generated by DeepZoom Composer to the project.

4. Add the following code to display the gallery:

This. msi. ImageOpenSucceeded + = new RoutedEventHandler (msi_ImageOpenSucceeded );

 

Void msi_ImageOpenSucceeded (object sender, RoutedEventArgs e)

{

Point point = this. msi. ViewportOrigin;

Msi. ViewportWidth = 1;

Msi. ViewportOrigin = new Point (0,-0.3 );

}

 

This. msi. Source = new DeepZoomImageTileSource (new Uri ("Assets/dzc_output.xml", UriKind. Relative ));

 

5. To move and scale the gallery, you also need to add the MouseMove, LButtonDown, and LbuttonUp responses.

Private void Zoom (double zoomnew, Point p)

{

If (zoomnew< 0.5)

Zoomnew= 0.5;

 

Msi. ZoomAboutLogicalPoint (zoomnew/zoom, p. X, p. Y );

Zoom = zoomnew;

}

Okay. Run it. It's not very interesting! Let's see the effect.

 

Related Article

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.