zoukankan      html  css  js  c++  java
  • 一起学Windows phone 7开发(四. DeepZoom)

    DeepZoom silverlight的特色功能之一,也同样被加到了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));

     

    五.要让图集移动,缩放,还需要加入MouseMove,LButtonDown,LbuttonUp的响应。

            private void Zoom(double zoomnew, Point p)

            {

                if (zoomnew < 0.5)

                    zoomnew = 0.5;

     

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

                zoom = zoomnew;

            }

    好了,运行一下吧,看看是不很有趣!看看效果吧。

  • 相关阅读:
    软工实践1816-第四次作业
    软工实践1816-第三次作业
    软工实践1816-第二次作业
    Alpha 冲刺 (3/10)
    Alpha 冲刺 (2/10)
    Alpha 冲刺 (1/10)
    福大软工 · 第七次作业
    福大软工 · 第八次作业(课堂实战)- 项目UML设计(团队)
    福大软工1816 · 第六次作业
    福大软工1816 · 第五次作业
  • 原文地址:https://www.cnblogs.com/bicabo/p/1793019.html
Copyright © 2011-2022 走看看