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
{
int x = 0 ;
public Form1( )
{
InitializeComponent( ) ;
}
private void Form1_Load( object sender, EventArgs e)
{
//ダブルバッファリング
this.SetStyle ( ControlStyles.DoubleBuffer , true ) ;
this.SetStyle ( ControlStyles.UserPaint , true ) ;
this.SetStyle ( ControlStyles.AllPaintingInWmPaint , true ) ;
}
protected override void OnPaint( PaintEventArgs e)
{
base.OnPaint ( e) ;
//四角形描画
e.Graphics .FillRectangle ( Brushes.Red , x, 50 , 100 , 100 ) ;
}
private void Form1_Shown( object sender, EventArgs e)
{
//ゲームループ
System.Diagnostics .Stopwatch sw = new System.Diagnostics .Stopwatch ( ) ;
sw.Start ( ) ;
double nextframe = ( double ) sw.ElapsedMilliseconds ;
float wait = 1000f / 60f ;
while ( this.Created )
{
if ( ( double ) sw.ElapsedMilliseconds >= nextframe)
{
//計算処理
x++;
if ( ( double ) sw.ElapsedMilliseconds < nextframe + wait)
{
//描画処理
this.Invalidate ( ) ;
}
nextframe += wait;
}
Application.DoEvents ( ) ;
}
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKdXNpbmcgU3lzdGVtLkNvbXBvbmVudE1vZGVsOwp1c2luZyBTeXN0ZW0uRGF0YTsKdXNpbmcgU3lzdGVtLkRyYXdpbmc7CnVzaW5nIFN5c3RlbS5MaW5xOwp1c2luZyBTeXN0ZW0uVGV4dDsKdXNpbmcgU3lzdGVtLldpbmRvd3MuRm9ybXM7CgpuYW1lc3BhY2UgV2luZG93c0Zvcm1zQXBwbGljYXRpb24xCnsKICAgIHB1YmxpYyBwYXJ0aWFsIGNsYXNzIEZvcm0xIDogRm9ybQogICAgewogICAgICAgIGludCB4ID0gMDsKCiAgICAgICAgcHVibGljIEZvcm0xKCkKICAgICAgICB7CiAgICAgICAgICAgIEluaXRpYWxpemVDb21wb25lbnQoKTsKICAgICAgICB9CgogICAgICAgIHByaXZhdGUgdm9pZCBGb3JtMV9Mb2FkKG9iamVjdCBzZW5kZXIsIEV2ZW50QXJncyBlKQogICAgICAgIHsKICAgICAgICAgICAgLy/jg4Djg5bjg6vjg5Djg4Pjg5XjgqHjg6rjg7PjgrAKICAgICAgICAgICAgdGhpcy5TZXRTdHlsZShDb250cm9sU3R5bGVzLkRvdWJsZUJ1ZmZlciwgdHJ1ZSk7CiAgICAgICAgICAgIHRoaXMuU2V0U3R5bGUoQ29udHJvbFN0eWxlcy5Vc2VyUGFpbnQsIHRydWUpOwogICAgICAgICAgICB0aGlzLlNldFN0eWxlKENvbnRyb2xTdHlsZXMuQWxsUGFpbnRpbmdJbldtUGFpbnQsIHRydWUpOwogICAgICAgIH0KCiAgICAgICAgcHJvdGVjdGVkIG92ZXJyaWRlIHZvaWQgT25QYWludChQYWludEV2ZW50QXJncyBlKQogICAgICAgIHsKICAgICAgICAgICAgYmFzZS5PblBhaW50KGUpOwoKICAgICAgICAgICAgLy/lm5vop5LlvaLmj4/nlLsKICAgICAgICAgICAgZS5HcmFwaGljcy5GaWxsUmVjdGFuZ2xlKEJydXNoZXMuUmVkLCB4LCA1MCwgMTAwLCAxMDApOwoKICAgICAgICB9CgogICAgICAgIHByaXZhdGUgdm9pZCBGb3JtMV9TaG93bihvYmplY3Qgc2VuZGVyLCBFdmVudEFyZ3MgZSkKICAgICAgICB7CiAgICAgICAgICAgIC8v44Ky44O844Og44Or44O844OXCiAgICAgICAgICAgIFN5c3RlbS5EaWFnbm9zdGljcy5TdG9wd2F0Y2ggc3cgPSBuZXcgU3lzdGVtLkRpYWdub3N0aWNzLlN0b3B3YXRjaCgpOwogICAgICAgICAgICBzdy5TdGFydCgpOwogICAgICAgICAgICBkb3VibGUgbmV4dGZyYW1lID0gKGRvdWJsZSlzdy5FbGFwc2VkTWlsbGlzZWNvbmRzOwogICAgICAgICAgICBmbG9hdCB3YWl0ID0gMTAwMGYgLyA2MGY7CiAgICAgICAgICAgIHdoaWxlICh0aGlzLkNyZWF0ZWQpCiAgICAgICAgICAgIHsKCiAgICAgICAgICAgICAgICBpZiAoKGRvdWJsZSlzdy5FbGFwc2VkTWlsbGlzZWNvbmRzID49IG5leHRmcmFtZSkKICAgICAgICAgICAgICAgIHsKCiAgICAgICAgICAgICAgICAgICAgLy/oqIjnrpflh6bnkIYKICAgICAgICAgICAgICAgICAgICB4Kys7CgogICAgICAgICAgICAgICAgICAgIGlmICgoZG91YmxlKXN3LkVsYXBzZWRNaWxsaXNlY29uZHMgPCBuZXh0ZnJhbWUgKyB3YWl0KQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgLy/mj4/nlLvlh6bnkIYKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5JbnZhbGlkYXRlKCk7CiAgICAgICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgICAgICBuZXh0ZnJhbWUgKz0gd2FpdDsKICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICBBcHBsaWNhdGlvbi5Eb0V2ZW50cygpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQp9Cg==
compilation info
prog.cs(4,14): error CS0234: The type or namespace name `Data' does not exist in the namespace `System'. Are you missing an assembly reference?
prog.cs(5,14): error CS0234: The type or namespace name `Drawing' does not exist in the namespace `System'. Are you missing an assembly reference?
prog.cs(8,14): error CS0234: The type or namespace name `Windows' does not exist in the namespace `System'. Are you missing an assembly reference?
Compilation failed: 3 error(s), 0 warnings
stdout