Expression > 论坛主页 > Deep Zoom Composer > How to change intital view?
提出问题提出问题
 

问题How to change intital view?

  • 2009年6月17日 6:25Radeldudel 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     

    How can I change the initial view of my image?

    The image is panoramic, and right now the initial view is stuck to the top of the viewport.

    I would like to move the initial view down, to center the image to the viewport, for more convenient zooming into the picture.

    thanks in advance,
    Sam

全部回复

  • 2009年6月17日 7:15Baruni 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     包含代码
    You make changes in the page.xaml.cs file.

    ViewportWidth
    The width of the area of the image displayed. This value is in logical coordinates. For example, a value of 1 displays the entire image (no zoom), a value of 0.5 is 200% zoomed in, and a value of 0 is completely zoomed (user cannot see the image at all). A value above 1 is zooming out from the image. For example, a value of 2 means that the image will take up half the size of the MultiScaleSubImage control area (50% zoom).


    The ViewportOrigin
    X (-0.02456985) =  The left coordinate of the rectangular area of the image to be displayed. The coordinates of the point are in local coordinates (0-1) relative to the displayed image width.
    Y (-0.35426895) = The top coordinate of the rectangular area of the image to be displayed. The coordinates of the point are in local coordinates (0-1) relative to the displayed image width.


            void msi_ImageOpenSucceeded(object sender, RoutedEventArgs e)
            {
                this.msi.ViewportWidth = 0.5;
                this.msi.ViewportOrigin = new Point(-0.02456985, -0.035426895);
                ZoomFactor = 0.5;
            }
    
    See further:

    http://msdn.microsoft.com/en-us/library/cc645050(VS.95).aspx