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 panel1_Paint(object sender, PaintEventArgs e) { panel1.DrawVisualStyleBorder(e.Graphics, new Rectangle(0, 0, panel1.Width - 1, panel1.Height - 1)); } private void ProgressForm_Shown(object sender, EventArgs e) { lblProgress.Width = Width - lblProgress.Left * 2; Application.DoEvents(); } /// /// /// public void ShowProgressMessage(string message) { lblProgress.Text = message; lblProgress.Refresh(); if (ticks++ % 10 == 0) Application.DoEvents(); } /// /// 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(); } } }