#2
by Math » 8年前
Windows10のみ使用。(VisualStudio不要)
f.bat
コード:
C:\windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe f1.cs
f1.exe
pause
f1.cs
コード:
using System;
using System.Windows.Forms;
using System.Drawing;
public class Program
{
[STAThread]
static void Main()
{
Form f;
TextBox usercontrol;
f = new Form();
usercontrol = new TextBox();
f.Text = "Form";
usercontrol.Text = "ABC";
f.Size = new Size(300, 200);
f.Location = new Point(200, 300);
usercontrol.Location = new Point(30, 20);
f.Controls.Add(usercontrol);
// [単一行ラムダ式]
usercontrol.KeyDown += (sender, e) => usercontrol.Text = "Key Down";
usercontrol.KeyUp += (sender, e) => usercontrol.Text = "Key Up";
Application.Run(f);
}
}
f.bat をWクリックする。

zキーを押す

放す

Windows10のみ使用。(VisualStudio不要)
f.bat
[code]
C:\windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe f1.cs
f1.exe
pause
[/code]
f1.cs
[code]
using System;
using System.Windows.Forms;
using System.Drawing;
public class Program
{
[STAThread]
static void Main()
{
Form f;
TextBox usercontrol;
f = new Form();
usercontrol = new TextBox();
f.Text = "Form";
usercontrol.Text = "ABC";
f.Size = new Size(300, 200);
f.Location = new Point(200, 300);
usercontrol.Location = new Point(30, 20);
f.Controls.Add(usercontrol);
// [単一行ラムダ式]
usercontrol.KeyDown += (sender, e) => usercontrol.Text = "Key Down";
usercontrol.KeyUp += (sender, e) => usercontrol.Text = "Key Up";
Application.Run(f);
}
}
[/code]
f.bat をWクリックする。
[img]http://csi.nisinippon.com/cs0724a.png[/img]
zキーを押す
[img]http://csi.nisinippon.com/cs0724b.png[/img]
放す
[img]http://csi.nisinippon.com/cs0724c.png[/img]