
前田稔(Maeda Minoru)の超初心者のプログラム入門
![]()
![]()
| Paint += new PaintEventHandler(MyHandler); |
| Font f = new Font("MS 明朝", 40); |
| g.DrawString("Windows", f, Brushes.Red, new PointF(10F, 50F)); |
namespace Auto
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Paint += new PaintEventHandler(MyHandler);
}
private void MyHandler(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Font f = new Font("MS 明朝", 40);
g.DrawString("Windows", f, Brushes.Red, new PointF(10F, 50F));
}
}
}
|
namespace Auto
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics g = e.Graphics;
g.DrawString("Windows", Font, Brushes.Black, new PointF(10f, 10f));
}
}
}
|
![]()
![]()