public override void ShowView(IView view, ViewDestination destination) { Control control = view.Control as Control; control.Dock = DockStyle.Fill; if (destination == ViewDestination.Tabbed) { TabPage tabPage = new TabPage(view.Tags[0]); tabPage.Name = view.ContentId.ToString("N"); tabPage.Location = new System.Drawing.Point(6, 6); tabPage.Controls.Add(control); tabPage.Tag = view; _Pages.Controls.Add(tabPage); } }
public virtual void ShowView(IView view, ViewDestination destination) { throw new NotSupportedException(); }
/** * bookmarkTree_AfterSelect - * * Occurs when a user clicks on a node in the bookmark treeview, * but only if they are not expanding a node. */ public void bookmarkTree_AfterSelect(object sender, TreeViewEventArgs e) { if (e.Action == TreeViewAction.ByMouse || e.Action == TreeViewAction.ByKeyboard) { int i = 0; while (i < bookmarkManager.numberOfBookmarks && e.Node.Handle != bookmarkManager.bookmarkMappingArray[i].treeNode.Handle) { i++; } if (i >= bookmarkManager.numberOfBookmarks) { return; } // get the bookmark information if (bookmarkManager.bookmarkMappingArray[i].action != null && bookmarkManager.bookmarkMappingArray[i].action is GoToAction && ((GoToAction)bookmarkManager.bookmarkMappingArray[i].action).Destination != null) { ViewDestination destination = ((GoToAction)bookmarkManager.bookmarkMappingArray[i].action).Destination; docView.GoToDestionation(destination); /* FitModes fitMode = FitModes.FitNone; * double newZoom = docView.Zoom; * int zoomIndex = 12; * Datalogics.PDFL.Point location = new Datalogics.PDFL.Point(0, 0); * switch (destination.FitType) * { * case "XYZ": * if (!double.IsInfinity(destination.Zoom) && Math.Abs(destination.Zoom) > 0.001) * newZoom = destination.Zoom; * fitMode = FitModes.FitNone; * location = new Datalogics.PDFL.Point(destination.DestRect.LLx, destination.DestRect.URy); * break; * case "Fit": * case "FitV": * fitMode = FitModes.FitPage; * location = new Datalogics.PDFL.Point(); * break; * case "FitH": * fitMode = FitModes.FitWidth; * zoomIndex = 11; * location = new Datalogics.PDFL.Point(0, destination.DestRect.URy); * break; * case "FitR": * case "FitB": * case "FitBH": * case "FitBV": * fitMode = FitModes.FitNone; * location = new Datalogics.PDFL.Point(destination.FitType == "FitBH" ? 0 : destination.DestRect.URx, destination.FitType == "FitBV" ? 0 : destination.DestRect.URy); * * Rect fitR = destination.FitType == "FitR" ? destination.DestRect : document.GetPage(destination.PageNumber).BBox; * double wRatio = (double)docView.Size.Width / (fitR.Width * docView.DPI); * double hRatio = (double)docView.Size.Height / (fitR.Height * docView.DPI); * newZoom = Math.Min(wRatio, hRatio); * if (!double.IsInfinity(newZoom) && Math.Abs(newZoom) > 0.001) * newZoom = Math.Max(Math.Min(newZoom, GlobalConsts.MAX_PERCENT_ZOOM_LEVEL), GlobalConsts.MIN_PERCENT_ZOOM_LEVEL); * break; * * default: * MessageBox.Show("Selected bookmark has unsupported destination type.", "Datalogics DotNETViewer"); * break; * } * docView.setZoom(fitMode, newZoom); * docView.Invalidate(); * * if (fitMode == FitModes.FitNone) * { * zoomManager.setCustomZoom(docView.Zoom); * zoomManager.onCustomZoomLevelSelected(); * } * else * zoomManager.onZoomLevelChanged(zoomIndex); * GoToPosition(docView.CalcPagePosition(destination.PageNumber, location));*/ } else { MessageBox.Show("Selected bookmark does not have a valid destination in the document.", "Datalogics DotNETViewer"); } } }