maskkid / open-webkit-sharp

Automatically exported from code.google.com/p/open-webkit-sharp
GNU Lesser General Public License v3.0
0 stars 0 forks source link

I solved PrintPreviewDialog() size. #124

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I solved PrintPreviewDialog() size.

PrintPreviewDialog()..etc is very small to preview simply.

I found this problem is about parent of WebBrowser.

In order to position of PrintPreviewDialog..PrintDialog..etc.,
You must send reference of parent control to those functions.

This problem was solved like this.

        /// <summary>
        /// Displays a Print Preview dialog box.
        /// Modified by James Park JJNET Co., Ltd.(www.jjnet.co.kr)
        /// in order to size dialog & protect script error
        /// </summary>
        public void ShowPrintPreviewDialog(Control parent)
        {
            try
            {
                WebBrowser br = new WebBrowser();

                // Javascript Error.. etc have not to be alerted for printing 
                br.ScriptErrorsSuppressed = true; // Added 2012.07.04

                br.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(br_DocumentCompleted);

                br.Tag = "PrintPreviewDlg";
                System.IO.File.WriteAllText(Application.StartupPath + @"\owstemp.html", DocumentText);
                br.Navigate(Application.StartupPath + @"\owstemp.html");
                br.Visible = false;

                // must be set because of position & size depend on Parent Control's position & size.
                parent.Controls.Add(br);

            }

Original issue reported on code.google.com by jjnetko...@gmail.com on 4 Jul 2012 at 8:21

GoogleCodeExporter commented 8 years ago
Great! Thanks for this contribution! You will be credited for the code you gave,

Original comment by tsumalis96@gmail.com on 4 Jul 2012 at 4:35

GoogleCodeExporter commented 8 years ago
Code added in 3.0.1. Thanks for the contribution!

Original comment by tsumalis96@gmail.com on 10 Nov 2012 at 3:12