概要
cscの作法、調べてみた。
練習問題やってみた。
練習問題
googlの検索ボタンを押せ。
サンプルコード
using System;
using System.Windows.Forms;
using System.Drawing;
class form1: Form {
WebBrowser wb0;
form1() {
Text = "WebBrowser";
ClientSize = new Size(600, 800);
Button btn1 = new Button();
btn1.Location = new Point(50, 20);
btn1.Text = "test";
btn1.Click += btn1_Click;
Controls.AddRange(new Control[] {
btn1
});
wb0 = new WebBrowser();
wb0.Location = new Point(50, 50);
wb0.Width = 500;
wb0.Height = 700;
Controls.AddRange(new Control[] {
wb0
});
string url = "http://www.google.co.jp/";
wb0.Navigate(url);
}
void btn1_Click(object sender, System.EventArgs e) {
wb0.Focus();
wb0.Document.All.GetElementsByName("q")[0].InnerText = "ohisamallc";
SendKeys.Send("{tab}");
SendKeys.Send("{enter}");
}
[STAThread]
public static void Main() {
Application.Run(new form1());
}
}
以上。