fork download
  1. using System;
  2. using System.Drawing;
  3. using System.Windows.Forms;
  4.  
  5. namespace WindowsFormsApplication1
  6. {
  7. public partial class Form1 : Form
  8. {
  9. public Form1()
  10. {
  11. InitializeComponent();
  12. }
  13.  
  14. private void Form1_Shown(object sender, EventArgs e)
  15. {
  16. contextMenuStrip1.KeyDown += new KeyEventHandler(contextMenuStrip1_KeyDown);
  17. contextMenuStrip1.Closed += new ToolStripDropDownClosedEventHandler(contextMenuStrip1_Closed);
  18.  
  19. ContextMenuStrip cms = new ContextMenuStrip();
  20.  
  21. ToolStripItem item1 = new ToolStripMenuItem();
  22. item1.Text = "テスト1";
  23. cms.Items.Add(item1);
  24. contextMenuStrip1 = cms;
  25. contextMenuStrip1.Show(new Point(0, 0));
  26. }
  27.  
  28. void contextMenuStrip1_Closed(object sender, ToolStripDropDownClosedEventArgs e)
  29. {
  30. MessageBox.Show("メニューが閉じられました");
  31. }
  32.  
  33. void contextMenuStrip1_KeyDown(object sender, KeyEventArgs e)
  34. {
  35. MessageBox.Show("キーが押されました");
  36. }
  37.  
  38. }
  39. }
  40.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(2,14): error CS0234: The type or namespace name `Drawing' does not exist in the namespace `System'. Are you missing an assembly reference?
prog.cs(3,14): error CS0234: The type or namespace name `Windows' does not exist in the namespace `System'. Are you missing an assembly reference?
Compilation failed: 2 error(s), 0 warnings
stdout
Standard output is empty