Welcome

首页 / 软件开发 / Silverlight / 一起学Windows phone 7开发(四. DeepZoom)

一起学Windows phone 7开发(四. DeepZoom)2010-11-07 博客园 小镇DeepZoom 是的特色功能之一,也同样被加到了windows phone 7中来。这个功能现在应该算是phone7 Ui的主要功能了吧。因为phone7的很多Ui就是DeepZoom开发的,另外在MIX10大会有展出的漫画阅读软件也是由DeepZoom开发的,由此也可以看的出这个功能在phone7上的重要性。

一.要开发DeepZoom首先需要 DeepZoom Composer这个在expression下的工具来生成deepzoom图集。

二.新建windows phone application,在xaml设计窗口加入以下语句:

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

在Phone7中只能用MultiScaleImage来展示DeepZoom图集。

三.将DeepZoom Composer生成的图集加入到工程中。

四.加入如下代码,以显示图集:

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));