new Pen(ForeColor) : Pens : Graphics C# Source Code


Custom Search

C# Source Code » Graphics » Pens »

 

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);
     }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Graphics
» Pens