Quantcast
Channel: C#タグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 9747

cscの作法 その26

$
0
0

概要

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());
    }
}




以上。


Viewing all articles
Browse latest Browse all 9747

Trending Articles