Graphics.DrawLines : Graphics : Drawing 2D C# Examples


C# Examples » Drawing 2D » Graphics »

 

Graphics.DrawLines









    
using  System;
using  System.Drawing;
using  System.Drawing.Printing;
using  System.Windows.Forms;
      
class  PrintableForm:  Form
{
          public  static  void  Main()
          {
                    Application.Run(new  PrintableForm());
          }
          public  PrintableForm()
          {
                    ResizeRedraw  =  true;
          }
          protected  override  void  OnPaint(PaintEventArgs  pea)
          {
                    DoPage(pea.Graphics,  ForeColor,ClientSize.Width,  ClientSize.Height);
          }

          protected  void  DoPage(Graphics  grfx,  Color  clr,  int  cx,  int  cy)
          {
                    Point[]  apt  =  {new  Point(0,            0),
                                                  new  Point(cx  -  1,  0),
                                                  new  Point(cx  -  1,  cy  -  1),
                                                  new  Point(0,            cy  -  1),
                                                  new  Point(0,            0)};
      
                    grfx.DrawLines(new  Pen(clr),  apt);
          }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Drawing 2D
» Graphics