Ask a questionAsk a question
 

QuestionHow to change intital view?

  • Wednesday, June 17, 2009 6:25 AMRadeldudel Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    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

All Replies

  • Wednesday, June 17, 2009 7:15 AMBaruni Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    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