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.