I am looking for a way to view HTML in Winform application. Does anyone know if there is something like a browser control that I could use to render the HTML?

Thanks,
Serge.

Re: Viewin HTML in Winform application by pdavis68

pdavis68
Wed Jun 23 17:15:11 CDT 2004

Go to the Form Designer and right-click on the top of the Windows Forms
section of the tools list and click on Add/Remove Items...

Go to the COM Components page and check the "Microsoft Web Browser".

Then go to the bottom of the list of items under Windows Forms and drag the
web browser onto your form.

It's a COM component, but it's wrapper up very nicely. Take a look at the
documentation for IWebBrowser2 to find out how to manipulate it, but for the
most part, you treat it like a .NET component.

Do a google search on axWebBrowser and you'll find some sample code. I know
there are a few on Code Project.

Pete

"Serge" <Serge@discussions.microsoft.com> wrote in message
news:DE031FD3-F81E-4CD0-AEF0-3031840691C5@microsoft.com...
> I am looking for a way to view HTML in Winform application. Does anyone
know if there is something like a browser control that I could use to render
the HTML?
>
> Thanks,
> Serge.



Re: Viewin HTML in Winform application by Sahil

Sahil
Wed Jun 23 17:16:40 CDT 2004

You need this
http://www.windowsforms.net/TrackViews.aspx?ID=186&Type=Samples&Redir=http%3a%2f%2fwindowsforms.net%2fdownloads%2fgdn%2fXhtml2Rtf.zip

It's XHTML, not HTML, but hey close enough huh?

--
- Sahil Malik
Independent Consultant
You can reach me thru my blog - http://dotnetjunkies.com/WebLog/sahilmalik/



"Serge" <Serge@discussions.microsoft.com> wrote in message
news:DE031FD3-F81E-4CD0-AEF0-3031840691C5@microsoft.com...
> I am looking for a way to view HTML in Winform application. Does anyone
know if there is something like a browser control that I could use to render
the HTML?
>
> Thanks,
> Serge.



Re: Viewin HTML in Winform application by Sahil

Sahil
Wed Jun 23 17:19:06 CDT 2004

Yeh that'll work, but you get a real heavy duty axWebBrowser control ..
kinda like killing a fly with a hammer .. but if you must use that .. here
is sample code to render a "text" to a webbrowser control -

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using mshtml;

namespace WindowsApplication2
{
public class Form1 : System.Windows.Forms.Form
{
private AxSHDocVw.AxWebBrowser browser;
private System.ComponentModel.Container components = null;


public Form1()
{
InitializeComponent();
string url = "about:blank";
object o = System.Reflection.Missing.Value;
browser.Navigate ( url,ref o,ref o,ref o,ref o);

AxSHDocVw.DWebBrowserEvents2_StatusTextChangeEventHandler handler =
new
AxSHDocVw.DWebBrowserEvents2_StatusTextChangeEventHandler
(this.browser_StatusTextChange);
browser.StatusTextChange += handler;
}



private void browser_StatusTextChange
(object sender,
AxSHDocVw.DWebBrowserEvents2_StatusTextChangeEvent e)
{


mshtml.HTMLDocument doc =
(mshtml.HTMLDocument)this.browser.Document;
doc.body.innerHTML = "<H1>foo</H1>";
}


protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}


#region Windows Form Designer generated code


private void InitializeComponent()
{
System.Resources.ResourceManager resources = new

System.Resources.ResourceManager(typeof(Form1));
this.browser = new AxSHDocVw.AxWebBrowser();

((System.ComponentModel.ISupportInitialize)(this.browser)).BeginInit();
this.SuspendLayout();
//
// browser
//
this.browser.Enabled = true;
this.browser.Location = new System.Drawing.Point(16,
16);
this.browser.OcxState =


((System.Windows.Forms.AxHost.State)(resources.GetObject("browser.OcxState")
));
this.browser.Size = new System.Drawing.Size(344,
224);
this.browser.TabIndex = 0;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5,
13);
this.ClientSize = new System.Drawing.Size(392, 302);
this.Controls.AddRange(new
System.Windows.Forms.Control[] {
this.browser});
this.Name = "Form1";
this.Text = "Form1";

((System.ComponentModel.ISupportInitialize)(this.browser)).EndInit();
this.ResumeLayout(false);


}
#endregion


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


}
}



--
- Sahil Malik
Independent Consultant
You can reach me thru my blog - http://dotnetjunkies.com/WebLog/sahilmalik/



<pdavis68@hotmail.com> wrote in message
news:y5mdnV_OvqhynUfdRVn-tw@giganews.com...
> Go to the Form Designer and right-click on the top of the Windows Forms
> section of the tools list and click on Add/Remove Items...
>
> Go to the COM Components page and check the "Microsoft Web Browser".
>
> Then go to the bottom of the list of items under Windows Forms and drag
the
> web browser onto your form.
>
> It's a COM component, but it's wrapper up very nicely. Take a look at the
> documentation for IWebBrowser2 to find out how to manipulate it, but for
the
> most part, you treat it like a .NET component.
>
> Do a google search on axWebBrowser and you'll find some sample code. I
know
> there are a few on Code Project.
>
> Pete
>
> "Serge" <Serge@discussions.microsoft.com> wrote in message
> news:DE031FD3-F81E-4CD0-AEF0-3031840691C5@microsoft.com...
> > I am looking for a way to view HTML in Winform application. Does anyone
> know if there is something like a browser control that I could use to
render
> the HTML?
> >
> > Thanks,
> > Serge.
>
>



Re: Viewin HTML in Winform application by hirf-spam-me-here

hirf-spam-me-here
Wed Jun 23 18:03:08 CDT 2004

* "=?Utf-8?B?U2VyZ2U=?=" <Serge@discussions.microsoft.com> scripsit:
> I am looking for a way to view HTML in Winform application. Does
> anyone know if there is something like a browser control that I could
> use to render the HTML?

311303 WebOCHostVB.exe Hosts the WebBrowser Control in Visual Basic .NET
<URL:http://support.microsoft.com/?id=311303>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Re: Viewin HTML in Winform application by Serge

Serge
Wed Jun 23 18:03:03 CDT 2004

Thanks for suggestions,
It seems that this sample creats the .rtf format, what I am looking is to be able to display an HTML page that is an aggregate of several HTML documents that are dynamically contcatenated into a one page (as if it is some kind of a report). When user selects one of the buttons on a panel on the left, the panel on the right that hosts the HTML page should be able to scroll to the correct portion of the HTML report. It seems that I might be able to do this using the Browser ActiveX control.

Serge.

"Sahil Malik" wrote:

> You need this
> http://www.windowsforms.net/TrackViews.aspx?ID=186&Type=Samples&Redir=http%3a%2f%2fwindowsforms.net%2fdownloads%2fgdn%2fXhtml2Rtf.zip
>
> It's XHTML, not HTML, but hey close enough huh?
>
> --
> - Sahil Malik
> Independent Consultant
> You can reach me thru my blog - http://dotnetjunkies.com/WebLog/sahilmalik/
>
>
>
> "Serge" <Serge@discussions.microsoft.com> wrote in message
> news:DE031FD3-F81E-4CD0-AEF0-3031840691C5@microsoft.com...
> > I am looking for a way to view HTML in Winform application. Does anyone
> know if there is something like a browser control that I could use to render
> the HTML?
> >
> > Thanks,
> > Serge.
>
>
>