fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace WindowsFormsApplication1
  11. {
  12. public partial class Form1 : Form
  13. {
  14. int x = 0;
  15.  
  16. public Form1()
  17. {
  18. InitializeComponent();
  19. }
  20.  
  21. private void Form1_Load(object sender, EventArgs e)
  22. {
  23. //ダブルバッファリング
  24. this.SetStyle(ControlStyles.DoubleBuffer, true);
  25. this.SetStyle(ControlStyles.UserPaint, true);
  26. this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
  27. }
  28.  
  29. protected override void OnPaint(PaintEventArgs e)
  30. {
  31. base.OnPaint(e);
  32.  
  33. //四角形描画
  34. e.Graphics.FillRectangle(Brushes.Red, x, 50, 100, 100);
  35.  
  36. }
  37.  
  38. private void Form1_Shown(object sender, EventArgs e)
  39. {
  40. //ゲームループ
  41. double nextframe = (double)System.Environment.TickCount;
  42. float wait = 1000f / 60f;
  43. while (this.Created)
  44. {
  45.  
  46. if ((double)System.Environment.TickCount >= nextframe)
  47. {
  48.  
  49. //計算処理
  50. x++;
  51.  
  52. if ((double)System.Environment.TickCount < nextframe + wait)
  53. {
  54. //描画処理
  55. this.Invalidate();
  56. }
  57.  
  58. nextframe += wait;
  59. }
  60.  
  61. Application.DoEvents();
  62. }
  63. }
  64. }
  65. }
  66.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
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
Standard output is empty