示例#1
0
        /// <summary>
        /// Handles the DocumentCompleted event of the Browser control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.WebBrowserDocumentCompletedEventArgs"/> instance containing the event data.</param>
        /// <remarks>Documented by Dev02, 2008-01-24</remarks>
        private void Browser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            if (statusDialog != null && statusDialog.Visible)
            {
                statusDialog.Close();
            }

            //now the webpage has finished loading and can be printed [ML-63]
            if (sender is WebBrowser && ((WebBrowser)sender).Tag is Button)
            {
                Button button = ((Button)((WebBrowser)sender).Tag);
                if (button == buttonPreview)
                {
                    //little hack to resize the PreviewDialog Window - without that, it would be shown in the size of this dialog
                    //if there is any other way, let me know ;-) AWE
                    ParentWizard.Hide();
                    Size size = ParentWizard.Size;
                    ParentWizard.Size = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
                    Browser.ShowPrintPreviewDialog();
                    Application.DoEvents();
                    ParentWizard.Size = size;
                    ParentWizard.Show();
                }
                else if (button == buttonPrint)
                {
                    Browser.ShowPrintDialog();
                }
            }

            this.Enabled = true;
            if (this.ParentWizard is Wizard)
            {
                this.ParentWizard.Enabled = true;
            }
        }