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.Drawing.Imaging;
  7. using System.Drawing.Drawing2D;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Windows.Forms;
  11.  
  12. namespace WindowsFormsApplication1
  13. {
  14. public partial class Form1 : Form
  15. {
  16. public Form1()
  17. {
  18. InitializeComponent();
  19. }
  20.  
  21.  
  22. Panel panel1;
  23. Button button1;
  24. PictureBox pictureBox1;
  25. Timer timer1;
  26. const int startpointX = 50;
  27. const int startpointY = 50;
  28. const int endpointX = 500;
  29. const int endpointY = 50;
  30. const int movesizeX = 2;
  31. const int movesizeY = 0;
  32. private void Form1_Load(object sender, EventArgs e)
  33. {
  34. this.ClientSize = new Size(800, 600);
  35.  
  36. panel1 = new Panel();
  37. panel1.Dock = DockStyle.Bottom;
  38. this.Controls.Add(panel1);
  39.  
  40. button1 = new Button();
  41. button1.Text = "実行";
  42. button1.Click += new EventHandler(button1_Click);
  43. panel1.Controls.Add(button1);
  44.  
  45. Bitmap bmp = new Bitmap(100, 100, PixelFormat.Format32bppArgb);
  46. using (Graphics g = Graphics.FromImage(bmp))
  47. {
  48. //g.FillRectangle(Brushes.White, 0, 0, bmp.Width, bmp.Height);
  49. g.FillRectangle(Brushes.Transparent, 0, 0, bmp.Width, bmp.Height);
  50. //g.SmoothingMode = SmoothingMode.AntiAlias;
  51. Pen pen1 = new Pen(Brushes.Red,1);
  52. g.DrawEllipse(pen1, 0, 0, 99, 99);
  53. pen1.Dispose();
  54. }
  55.  
  56. pictureBox1 = new PictureBox();
  57. pictureBox1.Image = bmp;
  58. pictureBox1.Location = new Point(startpointX, startpointY);
  59. pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
  60.  
  61. this.Controls.Add(pictureBox1);
  62.  
  63. timer1 = new Timer();
  64. timer1.Interval = 1000 / 60;
  65. timer1.Enabled = false;
  66. timer1.Tick += new EventHandler(timer1_Tick);
  67. }
  68.  
  69. void timer1_Tick(object sender, EventArgs e)
  70. {
  71. if (pictureBox1.Location.X >= endpointX)
  72. {
  73. timer1.Enabled = false;
  74. button1.Enabled = true;
  75. }
  76. else
  77. {
  78. pictureBox1.Location = new Point(pictureBox1.Location.X + movesizeX, pictureBox1.Location.Y + movesizeY);
  79. }
  80. }
  81.  
  82. void button1_Click(object sender, EventArgs e)
  83. {
  84. button1.Enabled = false;
  85. pictureBox1.Location = new Point(startpointX, startpointY);
  86. timer1.Enabled = true;
  87. }
  88. }
  89. }
  90.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty