using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace doublebuf
{
///
/// Form1 の概要の説明です。
///
public class Form1 : System.Windows.Forms.Form
{
///
/// 必要なデザイナ変数です。
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows フォーム デザイナ サポートに必要です。
//
InitializeComponent();
//
// TODO: InitializeComponent 呼び出しの後に、コンストラクタ コードを追加してください。
//
}
///
/// 使用されているリソースに後処理を実行します。
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows フォーム デザイナで生成されたコード
///
/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
/// コード エディタで変更しないでください。
///
private void InitializeComponent()
{
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 12);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
}
#endregion
///
/// アプリケーションのメイン エントリ ポイントです。
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
Image bitmap;
private void Form1_Load(object sender, System.EventArgs e)
{
System.Net.WebClient wc = new System.Net.WebClient();
System.IO.Stream stream = wc.OpenRead("http://www.atmarkit.co.jp/fdotnet/images/fdotnet_m.gif");
bitmap = new Bitmap(stream);
stream.Close();
this.SetStyle(ControlStyles.ResizeRedraw, true);
this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint (e);
float scale =
(float)this.ClientSize.Width / (float)bitmap.Width / 2F;
e.Graphics.TranslateTransform(
this.ClientSize.Width / 2, this.ClientSize.Height / 2);
e.Graphics.ScaleTransform(scale, scale);
for (int i = 0; i < 360; i += 10)
{
e.Graphics.RotateTransform(10);
e.Graphics.DrawImage(bitmap, 0, 0);
}
}
}
}