private void Click(ReportComponentBase c, int pageN, ReportPage page) { c.OnClick(null); if (Report.NeedRefresh) { Report.InteractiveRefresh(); } else { Report.PreparedPages.ModifyPage(pageN, page); } }
private void Click(ReportComponentBase c, ReportPage page, int pageN) { c.OnClick(null); Refresh(pageN, page); }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); if (Disabled) { return; } Cursor = curHand; // find object under mouse to invoke its PreviewClick event int pageNo = PreviewPages.FindPage(Offset.X + e.X, Offset.Y + e.Y); ReportPage page = PreparedPages.GetCachedPage(pageNo); Rectangle pageBounds = PreviewPages.GetPageBounds(pageNo); // reset NeedRefresh flag page.NeedRefresh = false; page.NeedModify = false; Report.NeedRefresh = false; // generate mouseup event if (FActiveObject != null) { FActiveObject.OnMouseUp(new MouseEventArgs(e.Button, e.Clicks, (int)Math.Round((Offset.X + e.X - pageBounds.X) / Zoom - page.LeftMargin * Units.Millimeters - FActiveObject.AbsLeft), (int)Math.Round((Offset.Y + e.Y - pageBounds.Y) / Zoom - page.TopMargin * Units.Millimeters - FActiveObject.AbsTop), e.Delta)); Hyperlink hyperlink = FActiveObject.Hyperlink; switch (hyperlink.Kind) { case HyperlinkKind.URL: try { Process.Start(hyperlink.Value); } catch { } break; case HyperlinkKind.PageNumber: PageNo = int.Parse(hyperlink.Value); break; case HyperlinkKind.Bookmark: Bookmarks.BookmarkItem bookmark = PreparedPages.Bookmarks.Find(hyperlink.Value); if (bookmark != null) { PositionTo(bookmark.PageNo + 1, new PointF(0, bookmark.OffsetY)); } break; case HyperlinkKind.DetailReport: // if detail report name is empty, refresh this report if (String.IsNullOrEmpty(hyperlink.DetailReportName)) { hyperlink.SetParameters(Report); Report.NeedRefresh = true; } else { // open a new report. check if such tab is opened already if (!Preview.SwitchToTab(hyperlink.Value)) { FLocked = true; try { using (Report report = hyperlink.GetReport(true)) { report.Prepare(); Preview.AddPreviewTab(report.PreparedPages, hyperlink.Value); report.SetPreparedPages(null); } } finally { FLocked = false; } } } break; case HyperlinkKind.DetailPage: ReportPage reportPage = Report.FindObject(hyperlink.DetailPageName) as ReportPage; if (reportPage != null) { hyperlink.SetParameters(Report); // check if such tab is opened already if (!Preview.SwitchToTab(hyperlink.Value)) { FLocked = true; Preview.Lock(); PreparedPages pages = new PreparedPages(Report); try { Report.SetPreparedPages(pages); Report.PreparePage(reportPage); } finally { FLocked = false; Preview.Unlock(); Preview.AddPreviewTab(pages, hyperlink.Value); } } } break; } FActiveObject.OnClick(EventArgs.Empty); } // modify and refresh the page if requested in the object's script if (page.NeedModify) { PreparedPages.ModifyPage(pageNo, page); } if (page.NeedRefresh) { Refresh(); } if (Report.NeedRefresh) { bool saveShowProgress = Config.ReportSettings.ShowProgress; Config.ReportSettings.ShowProgress = false; RefreshReport(); Config.ReportSettings.ShowProgress = saveShowProgress; } }