new Pen(ForeColor) : Pen « System.Drawing « C# / C Sharp by API






new Pen(ForeColor)

 
using System;
using System.Drawing;
using System.Windows.Forms;
   
class XMarksTheSpot: Form
{
     public static void Main()
     {
          Application.Run(new XMarksTheSpot());
     }
     public XMarksTheSpot()
     {
          Text = "X Marks The Spot";
          ResizeRedraw = true;
     }
     protected override void OnPaint(PaintEventArgs pea)
     {
          Graphics grfx = pea.Graphics;
          Pen      pen  = new Pen(ForeColor);
   
          grfx.DrawLine(pen, 0, 0, 
                             ClientSize.Width - 1, ClientSize.Height - 1);
          grfx.DrawLine(pen, 0, ClientSize.Height - 1, 
                             ClientSize.Width - 1, 0);
     }
}

   
  








Related examples in the same category

1.new Pen(Color.Black, 2)
2.Pen.DashCap.Triangle
3.Pen.DashPattern
4.Pen.DashStyle
5.Pen.Dispose()
6.Pen.LineJoin
7.Pen.StartCap