[Mono-winforms-list] WebBrowser + Printing

Rocky1 rocky1 at netcourrier.com
Mon Dec 8 14:59:10 EST 2008


If it can help, here is the code I used :

using System;
using System.Windows.Forms;

public class Form1 : Form
{
    private WebBrowser webBrowser1 = new WebBrowser();
    private Button button1 = new Button();

    [STAThread]
    public static void Main()
    {
        Application.EnableVisualStyles();
        Application.Run(new Form1());
    }

    public Form1()
    {
        button1.Text = "Print";
        button1.Dock = DockStyle.Top;
        button1.Click += new EventHandler(button1_Click);
        webBrowser1.Dock = DockStyle.Fill;
        Controls.Add(webBrowser1);
        Controls.Add(button1);
        Load += new EventHandler(Form1_Load);
        Text = "Internet Explorer";
    }

    private void Form1_Load(object sender, EventArgs e)
    {

       
webBrowser1.Navigate("http://www.javascriptkit.com/howto/newtech2.shtml");
    }

    private void button1_Click(object sender, EventArgs e)
    {
        webBrowser1.Document.InvokeScript("print");
    }

}

It's a modified example found in MSDN. The web page is a Javascript tutorial
where you can test the "print" function.
-- 
View this message in context: http://www.nabble.com/WebBrowser-%2B-Printing-tp20745942p20902408.html
Sent from the Mono - WinForms mailing list archive at Nabble.com.



More information about the Mono-winforms-list mailing list