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)
{
//ゲームループ
double nextframe = ( double ) System.Environment .TickCount ;
float wait = 1000f / 60f ;
while ( this.Created )
{
if ( ( double ) System.Environment .TickCount >= nextframe)
{
//計算処理
x++;
if ( ( double ) System.Environment .TickCount < nextframe + wait)
{
//描画処理
this.Invalidate ( ) ;
}
nextframe += wait;
}
Application.DoEvents ( ) ;
}
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKdXNpbmcgU3lzdGVtLkNvbXBvbmVudE1vZGVsOwp1c2luZyBTeXN0ZW0uRGF0YTsKdXNpbmcgU3lzdGVtLkRyYXdpbmc7CnVzaW5nIFN5c3RlbS5MaW5xOwp1c2luZyBTeXN0ZW0uVGV4dDsKdXNpbmcgU3lzdGVtLldpbmRvd3MuRm9ybXM7CgpuYW1lc3BhY2UgV2luZG93c0Zvcm1zQXBwbGljYXRpb24xCnsKICAgIHB1YmxpYyBwYXJ0aWFsIGNsYXNzIEZvcm0xIDogRm9ybQogICAgewogICAgICAgIGludCB4ID0gMDsKCiAgICAgICAgcHVibGljIEZvcm0xKCkKICAgICAgICB7CiAgICAgICAgICAgIEluaXRpYWxpemVDb21wb25lbnQoKTsKICAgICAgICB9CgogICAgICAgIHByaXZhdGUgdm9pZCBGb3JtMV9Mb2FkKG9iamVjdCBzZW5kZXIsIEV2ZW50QXJncyBlKQogICAgICAgIHsKICAgICAgICAgICAgLy/jg4Djg5bjg6vjg5Djg4Pjg5XjgqHjg6rjg7PjgrAKICAgICAgICAgICAgdGhpcy5TZXRTdHlsZShDb250cm9sU3R5bGVzLkRvdWJsZUJ1ZmZlciwgdHJ1ZSk7CiAgICAgICAgICAgIHRoaXMuU2V0U3R5bGUoQ29udHJvbFN0eWxlcy5Vc2VyUGFpbnQsIHRydWUpOwogICAgICAgICAgICB0aGlzLlNldFN0eWxlKENvbnRyb2xTdHlsZXMuQWxsUGFpbnRpbmdJbldtUGFpbnQsIHRydWUpOwogICAgICAgIH0KCiAgICAgICAgcHJvdGVjdGVkIG92ZXJyaWRlIHZvaWQgT25QYWludChQYWludEV2ZW50QXJncyBlKQogICAgICAgIHsKICAgICAgICAgICAgYmFzZS5PblBhaW50KGUpOwoKICAgICAgICAgICAgLy/lm5vop5LlvaLmj4/nlLsKICAgICAgICAgICAgZS5HcmFwaGljcy5GaWxsUmVjdGFuZ2xlKEJydXNoZXMuUmVkLCB4LCA1MCwgMTAwLCAxMDApOwoKICAgICAgICB9CgogICAgICAgIHByaXZhdGUgdm9pZCBGb3JtMV9TaG93bihvYmplY3Qgc2VuZGVyLCBFdmVudEFyZ3MgZSkKICAgICAgICB7CiAgICAgICAgICAgIC8v44Ky44O844Og44Or44O844OXCiAgICAgICAgICAgIGRvdWJsZSBuZXh0ZnJhbWUgPSAoZG91YmxlKVN5c3RlbS5FbnZpcm9ubWVudC5UaWNrQ291bnQ7CiAgICAgICAgICAgIGZsb2F0IHdhaXQgPSAxMDAwZiAvIDYwZjsKICAgICAgICAgICAgd2hpbGUgKHRoaXMuQ3JlYXRlZCkKICAgICAgICAgICAgewoKICAgICAgICAgICAgICAgIGlmICgoZG91YmxlKVN5c3RlbS5FbnZpcm9ubWVudC5UaWNrQ291bnQgPj0gbmV4dGZyYW1lKQogICAgICAgICAgICAgICAgewoKICAgICAgICAgICAgICAgICAgICAvL+ioiOeul+WHpueQhgogICAgICAgICAgICAgICAgICAgIHgrKzsKCiAgICAgICAgICAgICAgICAgICAgaWYgKChkb3VibGUpU3lzdGVtLkVudmlyb25tZW50LlRpY2tDb3VudCA8IG5leHRmcmFtZSArIHdhaXQpCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAvL+aPj+eUu+WHpueQhgogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLkludmFsaWRhdGUoKTsKICAgICAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgICAgIG5leHRmcmFtZSArPSB3YWl0OwogICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgIEFwcGxpY2F0aW9uLkRvRXZlbnRzKCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9Cn0K
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