using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.Load += new EventHandler(Form1_Load);
this.Shown += new EventHandler(Form1_Shown);
}
WebBrowser webBrowser1 = new WebBrowser();
TabControl tabControl1 = new TabControl();
TextBox textBox1 = new TextBox();
TabPage tabPage1 = new TabPage();
TabPage tabPage2 = new TabPage();
void Form1_Load(object sender, EventArgs e)
{
webBrowser1.Dock = DockStyle.Fill;
textBox1.Multiline = true;
textBox1.Dock = DockStyle.Fill;
tabPage1.Text = "Web";
tabPage1.Controls.Add(webBrowser1);
tabPage2.Text = "Text";
tabPage2.Controls.Add(textBox1);
tabControl1.TabPages.Add(tabPage1);
tabControl1.TabPages.Add(tabPage2);
tabControl1.Dock = DockStyle.Fill;
this.Controls.Add(tabControl1);
}
void Form1_Shown(object sender, EventArgs e)
{
webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser1_DocumentCompleted);
webBrowser1.DocumentText =
"<html>\n\t<head>\n\t</head>\n" +
"\t<body>\n\t\t<basefont face='MS Pゴシック'>\n\t\t<dl>\n" +
"\t\t</dl>\n\t</body>\n</html>\n";
}
void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
HtmlDocument doc = webBrowser1.Document;
HtmlElement elemdt = doc.CreateElement("dt");
elemdt.InnerHtml = "hogehoge1";
doc.Body.FirstChild.FirstChild.AppendChild(elemdt);
//ddタグ(2chの場合レス本文)
HtmlElement elemdd = doc.CreateElement("dd");
elemdd.InnerHtml = "ageage1";
doc.Body.FirstChild.FirstChild.AppendChild(elemdd);
textBox1.Text = webBrowser1.DocumentText;
}
}
}