/*★ Form を継承した MyForm で線を描画する 前田 稔 ★*/ using System; using System.Drawing; using System.Windows.Forms; public class MyForm : Form { public MyForm() { Paint += new PaintEventHandler(MyHandler); } private void MyHandler(object sender, PaintEventArgs e) { Graphics g = e.Graphics; g.DrawLine(new Pen(Color.Red),10,50,280,50); g.DrawLine(new Pen(Color.Green,10),10,100,280,100); } } class Draw { public static void Main() { MyForm mf = new MyForm(); Application.Run(mf); } } |
>CD C:\Data\C#\BAT\win >CSC Line.cs >Line.exe |
Paint += new PaintEventHandler(MyHandler); |