fork download
  1. using System;
  2. using System.Drawing;
  3. using System.Windows.Forms;
  4.  
  5. namespace AnimationTest3a
  6. {
  7. public class Form1 : Form
  8. {
  9. Timer timer1;
  10. PictureBox pictureBox1;//PictureBox
  11. Panel panel1;//Panel
  12. Bitmap canvas;
  13. int x = 0;
  14. int y = 20;
  15. const int radius = 50;
  16. Brush bg_brush = new SolidBrush(SystemColors.Control);
  17. Brush fg_brush = new SolidBrush(Color.Black);
  18. System.ComponentModel.IContainer components = null;
  19. protected override void Dispose(bool disposing)
  20. {
  21. if (disposing && (components != null)) components.Dispose();
  22. base.Dispose(disposing);
  23. }
  24. public Form1()
  25. {
  26. this.components = new System.ComponentModel.Container();
  27. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  28. timer1 = new Timer();
  29. timer1.Interval = 20;
  30. timer1.Tick += timer1_Tick;
  31. pictureBox1 = new PictureBox();//PictureBox
  32. panel1 = new Panel();//Panel
  33. this.Controls.Add(pictureBox1); this.Controls.Add(panel1);
  34. this.ClientSize = new Size(600, 400);
  35. pictureBox1.Size = new Size(600, 200);
  36. pictureBox1.BorderStyle = BorderStyle.FixedSingle;
  37. panel1.Size = new Size(600, 200);
  38. panel1.Location = new Point(0, 200);
  39. canvas = new Bitmap(600, 200);
  40. timer1.Start();
  41. }
  42. private void timer1_Tick(object sender, EventArgs e)
  43. {
  44. timer1.Enabled = false;
  45. Graphics g = Graphics.FromImage(canvas);
  46. int x2 = x + 2;
  47. g.FillRectangle(fg_brush, x2, y, radius, radius);
  48. g.FillRectangle(bg_brush, x, y, x2 - x, radius);
  49. x = x2;
  50. g.Dispose();
  51. pictureBox1.Image = new Bitmap(canvas);//PictureBox
  52. panel1.BackgroundImage = new Bitmap(canvas);
  53. if (x > 550)
  54. {
  55. x = 0; x2 = 0;
  56. canvas = new Bitmap(600, 200);
  57. }
  58. timer1.Enabled = true;
  59. }
  60. }
  61. static class Program
  62. {
  63. [STAThread]
  64. static void Main()
  65. {
  66. Application.EnableVisualStyles();
  67. Application.SetCompatibleTextRenderingDefault(false);
  68. Application.Run(new Form1());
  69. }
  70. }
  71. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(3,22): error CS0234: The type or namespace name `Forms' does not exist in the namespace `System.Windows'. Are you missing `System.Windows.Forms' assembly reference?
prog.cs(7,23): error CS0246: The type or namespace name `Form' could not be found. Are you missing an assembly reference?
prog.cs(9,9): error CS0246: The type or namespace name `Timer' could not be found. Are you missing `System.Threading' or `System.Timers' using directive?
prog.cs(10,9): error CS0246: The type or namespace name `PictureBox' could not be found. Are you missing an assembly reference?
prog.cs(11,9): error CS0246: The type or namespace name `Panel' could not be found. Are you missing an assembly reference?
prog.cs(19,33): error CS0115: `AnimationTest3a.Form1.Dispose(bool)' is marked as an override but no suitable method found to override
Compilation failed: 6 error(s), 0 warnings
stdout
Standard output is empty