private void AddReportControl(ReportItemBase reportItem, double factor) { ReportCtrl reportCtrl = null; if (reportItem is ReportPictureItem) { reportCtrl = new ReportCtrlPicture((ReportPictureItem)reportItem); } reportCtrl.Bounds = reportItem.Bounds; if (factor > 0) { reportPage.ReportItems.Add(reportItem); // _reportPage.ReportItems.Insert(0,reportItemBase); } this.Controls.Add(reportCtrl); try { this.Controls.SetChildIndex(reportCtrl, reportItem.Level); } catch { } reportCtrl.Scale(factor); if (factor > 0) { OnReportCtrlChanged(reportCtrl, ArrayChangedType.ItemAdded); } }
private void Zoom() { float coefficent = report.Factor / 100; if (report.Landscape) { this.pageHeight = (int)(PAGE_WIDTH * coefficent); this.pageWidth = (int)(PAGE_HEIGHT * coefficent); } else { this.pageHeight = (int)(PAGE_HEIGHT * coefficent); this.pageWidth = (int)(PAGE_WIDTH * coefficent); } AdjustPagePosition(); foreach (ReportPageUI rpu in pages) { foreach (Control con in rpu.Controls) { ReportCtrl rc = con as ReportCtrl; if (rc != null) { ZoomControl(rc, coefficent); } } } UncheckZoomItem(); GetZoomTool((int)report.Factor).Checked = true; }
private void ZoomControl(ReportCtrl rc, float coefficent) { rc.Width = (int)(rc.ReportItem.Bounds.Width * coefficent); rc.Height = (int)(rc.ReportItem.Bounds.Height * coefficent); rc.Location = new Point((int)(rc.ReportItem.Bounds.Location.X * coefficent), (int)(rc.ReportItem.Bounds.Location.Y * coefficent)); rc.Scale(report.Factor / 100); }
private void pageUI_ReportCtrlChanged(object sender, ArrayChangedEventArgs <ReportCtrl> e) { if (e.ChangeType == ArrayChangedType.ItemAdded) { ReportCtrl rc = e.Item; ZooomReportControl(rc); } }
private void AdjustPagePosition() { for (int i = 0; i < pages.Count; i++) { SetPageBounds(pages[i], i + 1); foreach (var item in pages[i].Controls) { ReportCtrl rc = item as ReportCtrl; if (rc != null) { rc.ResetSubCtrlLocation(); } } } }
private void PrintReport(Graphics g, ReportPageUI reportPageUI) { isPrinting = true; this.Invoke(new Action(() => { //reportPageUI.DrawPageHeadAndTail(g); for (int i = reportPageUI.Controls.Count - 1; i >= 0; i--) { ReportCtrl rCtrl = reportPageUI.Controls[i] as ReportCtrl; if (rCtrl != null) { rCtrl.IsPrint = true; rCtrl.Draw(g, rCtrl.ReportItem.Bounds); rCtrl.IsPrint = false; } } })); isPrinting = false; }
private void OnReportCtrlChanged(ReportCtrl temp, ArrayChangedType type) { ReportCtrlChanged?.Invoke(this, new ArrayChangedEventArgs <ReportCtrl>(temp, type)); }
private void ZooomReportControl(ReportCtrl rc) { float coefficent = report.Factor / 100; ZoomControl(rc, coefficent); }