2012-07-31 79 views
0

是否可以在Out of Browser模式下使用整個Silverlight應用程序的縮放功能(CTRL + MouseWheel /放大瀏覽器)?Silverlight放大瀏覽器

回答

0

您可以使用您 Application_Startup如下:

RootVisual = new WebBrowser() {Source = new Uri(Current.Host.Source, "../")}; 
0

好吧..我已經實現了「放大」和「縮小」按鈕點擊此代碼。

在按鈕單擊事件:

commonwidth = commonwidth + (commonwidth * zoomPercent/100) //For Zoom Out 
commonwidth = commonwidth + (commonwidth * zoomPercent/100) //For Zoom In 

然後調用這個方法:

  Private Sub ChangZoom() 

      If Not fresult Is Nothing Then 

       If fresult.Count() > 0 Then 

        Dim mainFrame As StackPanel 

        mainFrame = fresult(_currentPage) 

        Dim docBorder As Border 

        docBorder = mainFrame.Children(1) 

        Dim docImage As FrameworkElement 

        docImage = docBorder.Child 

        If Not docImage Is Nothing Then 

         Dim actualWidth As Double 
         Dim actualHeight As Double 

         actualWidth = commonwidth 'Me.ActualWidth - 30 
         actualHeight = Me.ActualHeight 

         Dim newHeight As Double 

         newHeight = actualWidth * docImage.Height/docImage.Width 

         docImage.Width = actualWidth 
         docImage.Height = newHeight 

         RenderResutlFrame(_currentPage) 

        End If 

       End If 

      End If 

     End Sub 

     Public Property ImageUrl As String Implements IDocumentViewer.ImageUrl 
      Get 
       Return _imageUrl 
      End Get 
      Set(ByVal value As String) 
       _imageUrl = value 

       'Me.Dispatcher.BeginInvoke(AddressOf OnInitialized) 

      End Set 
     End Property