public ZoomTo(RdlViewer viewer) { // // Required for Windows Form Designer support // InitializeComponent(); _Viewer = viewer; // set the intial value for magnification if (_Viewer.ZoomMode == ZoomEnum.FitPage) { cbMagnify.Text = "Fit Page"; } else if (_Viewer.ZoomMode == ZoomEnum.FitWidth) { cbMagnify.Text = "Fit Width"; } else if (_Viewer.Zoom == 1) { cbMagnify.Text = "Actual Size"; } else { string formatted = string.Format("{0:#0.##}", _Viewer.Zoom * 100); if (formatted[formatted.Length - 1] == '.') { formatted = formatted.Substring(0, formatted.Length - 2); } formatted = formatted + "%"; cbMagnify.Text = formatted; } }
public DialogWait(RdlViewer viewer) { InitializeComponent(); _viewer = viewer; Started = DateTime.Now; timer1.Interval = 1000; timer1_Tick(null, null); timer1.Start(); }
public void Emitir(string consulta, string arquivo, Func<SQLiteCommand> metodoParametros) { //não gostei nada desse código, mas enfim.... var reportViewer = new RdlViewer(); var reportStrip = new ViewerToolstrip(ReportViewer); reportStrip.Viewer = ReportViewer; var query = new StringBuilder().Append(consulta); var dalConexao = dalConexao = new DALConexao(new DadosConexao().String_Conexao); var caminhoArquivo = new PathRelatorio(arquivo); if (caminhoArquivo.existeArquivo()) { //não gosto disto reportViewer.SourceFile = new Uri(caminhoArquivo.Path); reportViewer.Parameters += "conexao={dalConexao.Conexao.ConnectionString}"; reportViewer.Report.DataSets["Data"].SetData(obterTabela(dalConexao, metodoParametros)); reportViewer.Rebuild(); reportViewer.HideRunButton(); reportViewer.Dock = DockStyle.Fill; } }
override protected void OnMouseDown(MouseEventArgs mea) { base.OnMouseDown(mea); // allow base to process first _MousePosition = new Point(mea.X, mea.Y); if (MouseDownRubberBand(mea)) { return; } HitListEntry hle = cpim.GetHitListEntry(mea, cp.Zoom); cpim.SetHitListCursor(hle); // set the cursor based on the hit list entry if (mea.Button != MouseButtons.Left || hle == null) { return; } if (hle.PageItem.HyperLink != null) { RdlViewer rv = this.Parent as RdlViewer; bool bInvoke = true; if (rv != null) { HyperlinkEventArgs hlea = new HyperlinkEventArgs(hle.PageItem.HyperLink); rv.InvokeHyperlink(hlea); // reset any mousemove bInvoke = !hlea.Cancel; } try { if (bInvoke) { System.Diagnostics.Process.Start(hle.PageItem.HyperLink); } } catch (Exception ex) { MessageBox.Show(string.Format("Unable to link to {0}{1}{2}", hle.PageItem.HyperLink, Environment.NewLine, ex.Message), "HyperLink Error"); } } }
private void GeneratePDF2() { var viewer = new RdlViewer { SourceFile = new Uri(Path.Combine(Application.StartupPath, "FE2PDF.rdl")) }; foreach (var h in _data) { var header = new List <Header> { h }; var details = h.Items; viewer.Report.DataSets["Header"].SetData(header); viewer.Report.DataSets["Details"].SetData(details); viewer.Parameters = string.Empty; viewer.Parameters += $@"&bg_image={Path.Combine(Application.StartupPath, $"fc_{h.CondicionIVA.ToLower()}.jpg")}"; if (ConfigInfo.InvoiceCodeType != InvoiceCodeType.None) { if (ConfigInfo.InvoiceCodeType == InvoiceCodeType.QR) { var qr = h.CondicionIVA.Equals("a", StringComparison.OrdinalIgnoreCase) || h.CondicionIVA.Equals("b", StringComparison.OrdinalIgnoreCase) ? GenerateQR(h) : string.Empty; if (!string.IsNullOrEmpty(qr)) { viewer.Parameters += $@"&qrcode={qr}"; } } else { var barcode = !string.IsNullOrEmpty(h.CodigoBarra) ? Int2of5.GenerateBarCode(h.CodigoBarra, 1000, 100, 2).ToBase64() : string.Empty; if (!string.IsNullOrEmpty(barcode)) { viewer.Parameters += $@"&barcode={barcode}"; } } } viewer.Rebuild(); var pdfName = $@"{h.TipoComprobante}{h.CondicionIVA}{h.CentroEmisor}{h.NumeroComprobante}.pdf"; var outputFile = Path.Combine(txtOutputFolder.Text, pdfName); if (File.Exists(outputFile)) { File.Delete(outputFile); } viewer.SaveAs(outputFile, OutputPresentationType.PDF); barProgress.PerformStep(); lblStatus.Text = $@"Archivo PDF {barProgress.Value}/{barProgress.Maximum}"; Application.DoEvents(); } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.tcEHP = new System.Windows.Forms.TabControl(); this.tpDesign = new System.Windows.Forms.TabPage(); this.tpEditor = new System.Windows.Forms.TabPage(); this.tbEditor = new System.Windows.Forms.RichTextBox(); this.pbLines = new DesignEditLines(); this.tpBrowser = new System.Windows.Forms.TabPage(); this.rdlPreview = new Reporting.Viewer.RdlViewer(Reporting.Rdl.Utility.Measurement.PixelsFromPoints(DesignXmlDraw.LEFTGAP, 0, new PointF(96, 96))); this.tcEHP.SuspendLayout(); this.tpEditor.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pbLines)).BeginInit(); this.tpBrowser.SuspendLayout(); this.SuspendLayout(); // // tcEHP // this.tcEHP.Alignment = System.Windows.Forms.TabAlignment.Bottom; this.tcEHP.Controls.Add(this.tpDesign); this.tcEHP.Controls.Add(this.tpEditor); this.tcEHP.Controls.Add(this.tpBrowser); this.tcEHP.Dock = System.Windows.Forms.DockStyle.Fill; this.tcEHP.Location = new System.Drawing.Point(0, 0); this.tcEHP.Name = "tcEHP"; this.tcEHP.SelectedIndex = 0; this.tcEHP.ShowToolTips = true; this.tcEHP.Size = new System.Drawing.Size(488, 376); this.tcEHP.TabIndex = 0; this.tcEHP.SelectedIndexChanged += new System.EventHandler(this.tcEHP_SelectedIndexChanged); // // tpDesign // this.tpDesign.Location = new System.Drawing.Point(4, 4); this.tpDesign.Name = "tpDesign"; this.tpDesign.Size = new System.Drawing.Size(480, 350); this.tpDesign.TabIndex = 3; this.tpDesign.Tag = "design"; this.tpDesign.Text = "Designer"; // // tpEditor // this.tpEditor.Controls.Add(this.tbEditor); this.tpEditor.Controls.Add(this.pbLines); this.tpEditor.Location = new System.Drawing.Point(4, 4); this.tpEditor.Name = "tpEditor"; this.tpEditor.Size = new System.Drawing.Size(480, 350); this.tpEditor.TabIndex = 0; this.tpEditor.Tag = "edit"; this.tpEditor.Text = "RDL Text"; this.tpEditor.ToolTipText = "Edit Report Syntax"; // // tbEditor // this.tbEditor.AcceptsTab = true; this.tbEditor.BorderStyle = System.Windows.Forms.BorderStyle.None; this.tbEditor.Dock = System.Windows.Forms.DockStyle.Fill; this.tbEditor.HideSelection = false; this.tbEditor.Location = new System.Drawing.Point(32, 0); this.tbEditor.Name = "tbEditor"; this.tbEditor.Size = new System.Drawing.Size(448, 350); this.tbEditor.TabIndex = 0; this.tbEditor.Text = ""; this.tbEditor.WordWrap = false; this.tbEditor.TextChanged += new System.EventHandler(this.tbEditor_TextChanged); // // pbLines // this.pbLines.Dock = System.Windows.Forms.DockStyle.Left; this.pbLines.Location = new System.Drawing.Point(0, 0); this.pbLines.Name = "pbLines"; this.pbLines.Size = new System.Drawing.Size(32, 350); this.pbLines.TabIndex = 1; this.pbLines.TabStop = false; // // tpBrowser // this.tpBrowser.Controls.Add(this.rdlPreview); this.tpBrowser.Location = new System.Drawing.Point(4, 4); this.tpBrowser.Name = "tpBrowser"; this.tpBrowser.Size = new System.Drawing.Size(480, 350); this.tpBrowser.TabIndex = 2; this.tpBrowser.Tag = "preview"; this.tpBrowser.Text = "Preview"; // // rdlPreview // this.rdlPreview.Cursor = System.Windows.Forms.Cursors.Default; this.rdlPreview.Dock = System.Windows.Forms.DockStyle.Fill; this.rdlPreview.Folder = null; this.rdlPreview.Location = new System.Drawing.Point(0, 0); this.rdlPreview.Name = "rdlPreview"; this.rdlPreview.PageCurrent = 1; this.rdlPreview.Parameters = null; this.rdlPreview.ReportName = null; this.rdlPreview.ScrollMode = ScrollMode.Continuous; this.rdlPreview.ShowParameterPanel = true; this.rdlPreview.Size = new System.Drawing.Size(480, 350); this.rdlPreview.SourceFile = null; this.rdlPreview.SourceRdl = null; this.rdlPreview.TabIndex = 0; this.rdlPreview.Text = "rdlViewer1"; this.rdlPreview.Zoom = 0.5474582F; this.rdlPreview.ZoomMode = Reporting.Viewer.Enums.ZoomMode.FitWidth; // // RdlEditPreview // this.Controls.Add(this.tcEHP); this.Name = "RdlEditPreview"; this.Size = new System.Drawing.Size(488, 376); this.tcEHP.ResumeLayout(false); this.tpEditor.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.pbLines)).EndInit(); this.tpBrowser.ResumeLayout(false); this.ResumeLayout(false); }