private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
// MS明朝のアウトラインを描く。
Graphics g = e.Graphics;
GraphicsPath gPath = new System.Drawing.Drawing2D.GraphicsPath();
SolidBrush brush = new SolidBrush(SystemColors.WindowText);
FontFamily ff = new FontFamily("MS 明朝");
gPath.AddString("MS明朝", ff, (int)FontStyle.Bold,
50, new Point(0, 0), StringFormat.GenericDefault);
g.DrawPath(new Pen(Color.Black, 1f), gPath);
GraphicsState gs = g.Save();
g.TranslateTransform(0f, 50f);
gPath.Reset();
gPath.AddString("目", ff, (int)FontStyle.Bold,
25, new Point(0, 0), StringFormat.GenericDefault);
g.DrawPath(new Pen(Color.Black, 1f), gPath);
g.TranslateTransform(50f, 0.5f);
g.DrawPath(new Pen(Color.Black, 1f), gPath);
g.Restore(gs);
// XX を重ねて描く。
g.TranslateTransform(0f, 50f);
gPath.Reset();
gPath.AddString("X", ff, (int)FontStyle.Bold,
200, new Point(0, 0), StringFormat.GenericDefault);
gPath.AddString("X", ff, (int)FontStyle.Bold,
200, new Point(20, 0), StringFormat.GenericDefault);
gPath.AddString("X", ff, (int)FontStyle.Bold,
200, new Point(40, 0), StringFormat.GenericDefault);
gPath.FillMode = FillMode.Alternate;
g.FillPath(new SolidBrush(Color.Cyan), gPath);
g.DrawPath(new Pen(Color.Black, 1f), gPath);
}
|