CodePanic! > C#.NET Tips > 今ここ
■ブラウザーを作る
ブラウザーを作る、と書くと大袈裟かもしれませんが
WebBrowserコントロールをFormに貼り付けるだけで
簡単なブラウザーを作ることができます。
下記の例は
開きたいアドレスをurlプロパティーに設定しています。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// Yahoo!を開く
Uri yahoo = new Uri("http://www.yahoo.co.jp/");
webBrowser1.Url = yahoo;
}
}
}
Copyright © 2008.07 - shougo suzaki
|