using System; using System.Drawing; using System.Windows.Forms; using FastReport.Utils; namespace FastReport.Forms { /// /// /// public partial class ProgressForm : BaseForm { private Report report; private bool aborted; private long ticks = 0; /// /// Gets Aborted state /// public bool Aborted { get { return aborted; } } private void btnCancel_Click(object sender, EventArgs e) { if (report != null) report.Abort(); aborted = true; } private void ProgressForm_Paint(object sender, PaintEventArgs e) { using (Pen p = new Pen(Color.Gray, 2)) { p.Alignment = System.Drawing.Drawing2D.PenAlignment.Inset; e.Graphics.DrawRectangle(p, DisplayRectangle); } } private void ProgressForm_Shown(object sender, EventArgs e) { lblProgress.Width = Width - lblProgress.Left * 2; } /// /// /// public void ShowProgressMessage(string message) { lblProgress.Text = message; lblProgress.Refresh(); if (ticks++ % 500 == 0) Config.DoEvent(); } /// /// Initialazes a new instance of the class. /// /// A reference to the report. public ProgressForm(Report report) { aborted = false; this.report = report; InitializeComponent(); btnCancel.Text = Res.Get("Buttons,Cancel"); UIUtils.CheckRTL(this); UpdateDpiDependencies(); } /// /// Initialazes a new instance of the class. /// /// A reference to the report. /// Specifies whether the form should be with Cancel button. public ProgressForm(Report report, bool withCancelButton) { this.report = report; InitializeComponent(); btnCancel.Text = Res.Get("Buttons,Cancel"); btnCancel.Enabled = withCancelButton; btnCancel.Visible = withCancelButton; lblProgress.Location = new Point(12, 50); UIUtils.CheckRTL(this); UpdateDpiDependencies(); } } }