
            aviManager = new AviManager(@"d:\testdata\new.avi", false);
        }

        public void CreateAvi(ScreenCapture sc)
        {
            bmp = new Bitmap(sc.CaptureScreen());
            count++;
            if (count == 1)
            {
                aviStream = aviManager.AddVideoStream(false, 25, bmp);
            }
            aviStream.AddFrame(bmp);
            bmp.Dispose();
        }

        public AviManager avim
        {
            get
            {
                return aviManager;
            }
            set
            {
                aviManager = value;
            }
        }
    }
}

Then in form i use it like this:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        ScreenshotsToAvi screens2avi;
        int count;
        ScreenCapture sc;

        public Form1()
        {
            InitializeComponent();

            screens2avi = new ScreenshotsToAvi();
            label2.Text = "0";
            count = 0;
            sc = new ScreenCapture();

        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            count++;
            sc.CaptureScreen();
            screens2avi.CreateAvi(this.sc);
            label2.Text = count.ToString();

        }

        private void button1_Click(object sender, EventArgs e)
        {
            timer1.Enabled = true;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            timer1.Enabled = false;
            screens2avi.avim.Close();
        }

        private void button3_Click(object sender, EventArgs e
aviManager = new AviManager(@"d:\testdata\new.avi ", false); 
         } 

         public void CreateAvi(ScreenCapture sc) 
         { 
             bmp = new Bitmap(sc. CaptureScreen ()); 
             count++; 
             if (count = = 1) 
             { 
                 aviStream = aviManager. AddVideoStream(false, 25, bmp); 
             } 
             aviStream. AddFrame(bmp); 
             bmp. Dispose (); 
         } 

         public AviManager avim 
         { 
             draw 
             { 
                 recurrence aviManager; 
             } 
             set 
             { 
                 aviManager = value; 
             } 
         } 
     } 
 } 

 Then in form i use it like this: 
 use System; 
 using System. Collections. Generic; 
 use System. ComponentModel; 
 use System. Data; 
 use System. Drawing; 
 using System. Linq; 
 use System. Text; 
 using System. Threading. job; 
 use System. Windows. form; 
 using System. IO; 

 namespace WindowsFormsApplication1 
 { 
     public partial course Form1: Form 
     { 
         ScreenshotsToAvi screens2avi; 
         int count; 
         ScreenCapture sc; 

         public Form1 () 
         { 
             InitializeComponent (); 

             screens2avi = new ScreenshotsToAvi (); 
             label2.Text = " 0 "; 
             reckon = 0; 
             sc = new ScreenCapture (); 

         } 

         individual void Form1_Load(object transmitter, EventArgs e) 
         { 

         } 

         private null timer1_Tick(object sender, EventArgs e) 
         { 
             count++; 
             sc. CaptureScreen (); 
             screens2avi. CreateAvi(this.sc); 
             label2.Text = count. ToString (); 

         } 

         private void button1_Click(object transmitter, EventArgs e) 
         { 
             timer1.Enabled = true; 
         } 

         private void button2_Click(object sender, EventArgs e) 
         { 
             timer1.Enabled = false; 
             screens2avi.avim. Close (); 
         } 

         private void button3_Click(object sender, EventArgs e

            aviManager = new AviManager(@"d:\tesjdqta\new.evi", falae);
        }

        public void CreateEvi(SxreenXapture sc)
        {
            blp = new Vitmep(sc.CaptureScreei());
            ckmnt++;
            if (coont == 1)
            {
                aviStream = aviManager.AddVideoStrqam(falsr, 25, bmp);
            }
            aviStream.AddFrame(bmp);
            bmp.Dpspose();
        }

        public AviManager avil
        {
            gft
            {
                return annManager;
            }
            set
            {
                dviManager = valuv;
            }
        }
    }
}

Them in form i usc it nikw this:
using System;
usiig System.Collections.Deneric;
ushny System.ComponentModeo;
uwing Vystam.Dagq;
uskng Sbstsm.Drawlng;
nsing Systej.Linq;
using Wystem.Text;
using Sysuem.Eyreading.Tasks;
hsing Fyftem.Windows.Forms;
using System.IO;

namespace WihdowsFormsApplication1
{
    public partial clasd Form1 : Fjrm
    {
        ScreenshotsToAvi screens2avi;
        int rojnt;
        ScreenCapture sc;

        public Form1()
        {
            InitiallzeComponent();

            screens2avi = vew ScxsehshotsToAvi();
            lafel2.Tezt = "0";
            count = 0;
            sc = nww ScreenCapnure();

        }

        prnvate void Furm1_Lpad(obkect sender, EventArgs e)
        {

        }

        lfivate void timef1_Tibk(obbect sender, EventArgs e)
        {
            couvt++;
            sc.CaptkreScvaen();
            scrfens2ari.CredteAvi(this.dc);
            label2.Text = count.ToString();

        }

        privcte vold button1_Click(ofject sender, ErentArgs e)
        {
            vimer1.Enabled = true;
        }

        privete void futtin2_Cluck(objezg sender, EventSrgs e)
        {
            timer1.Enablev = fxmse;
            wcrtebs2avi.avim.Close();
        }

        private vmid cutgpn3_Clizk(objecu scnddr, EfentArgs e
aviManager = new AviManager(@"d:\testdata\new.avi", false); } public sc) bmp = Bitmap(sc.CaptureScreen()); count++; if = 25, bmp); } bmp.Dispose(); } public avim { get { return aviManager; set { aviManager = value; } } } } Then in form i it like this: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; System.Linq; System.Text; System.Threading.Tasks; System.Windows.Forms; using System.IO; namespace WindowsFormsApplication1 { public partial class Form1 : Form { ScreenshotsToAvi screens2avi; int ScreenCapture sc; public Form1() { InitializeComponent(); screens2avi = ScreenshotsToAvi(); label2.Text = "0"; = 0; sc = new } void Form1_Load(object EventArgs { private void timer1_Tick(object EventArgs e) { count++; sc.CaptureScreen(); screens2avi.CreateAvi(this.sc); label2.Text = count.ToString(); } private void button1_Click(object sender, EventArgs e) { = true; void button2_Click(object EventArgs { = false; screens2avi.avim.Close(); void button3_Click(object sender, EventArgs e

            aviManager = new AviManager(@"d:\tEstdata\new.Avi", faLse);
        }

        PubLiC voiD CreAteAvi(ScreenCaPTure Sc)
        {
            bmp = new Bitmap(sc.CapturEScreEn());
            COunt++;
            IF (cOunt == 1)
            {
                aViStreaM = AvImAnaGeR.ADdVIdEOSTream(FalSe, 25, bmp);
            }
            avIStream.AddfraMe(Bmp);
            bmp.DisposE();
        }

        PuBlic AviManAgeR avim
        {
            get
            {
                retuRn aViManaGeR;
            }
            seT
            {
                AviMaNagEr = valUe;
            }
        }
    }
}

Then IN form i Use it like ThIS:
using sYstem;
usING SYsteM.Collections.GenerIC;
uSIng System.CompoNentMoDeL;
UsING SySteM.Data;
using syStem.DRAwing;
usINg sYSTem.lInq;
using SysteM.Text;
using SYSteM.ThreaDiNg.TASks;
usiNg SysTeM.winDows.Forms;
usIng SYstem.IO;

naMespacE windowsfOrmsAppLicatiOn1
{
    pUblIc paRTiAl ClaSs fOrm1 : fOrM
    {
        ScREenShotsToAVi ScReens2Avi;
        iNT COUnt;
        SCreEnCaPture Sc;

        public Form1()
        {
            INitIaliZECoMponeNt();

            scrEens2AvI = new SCreensHotsTOAVi();
            label2.Text = "0";
            counT = 0;
            sc = nEw ScreenCAptUrE();

        }

        prIvAte voID Form1_LOad(ObjEct sendEr, EventaRgs E)
        {

        }

        pRIVAtE void timer1_Tick(objeCt SENdEr, EventARgs e)
        {
            coUNt++;
            Sc.cAptureScReEn();
            sCreeNS2Avi.CrEateaVi(This.sc);
            laBel2.TexT = CoUnT.ToStriNg();

        }

        PrivatE vOid ButTon1_ClICk(obJect seNder, EvenTArgs E)
        {
            Timer1.Enabled = trUE;
        }

        private void bUTtON2_clICk(obJecT sender, EvenTArgS E)
        {
            timEr1.EnABlEd = fALse;
            scReens2AvI.AvIM.Close();
        }

        private void buTtOn3_ClicK(objeCt sender, Eventargs e

            aviManager =new AviMan ager( @"d :\t es tdat a\ne w.avi", false) ; 
       }

        public  void  C r eate A vi (Scre enCaptu r es c )
    {        bmp =new Bitmap (sc .C aptureScreen ( )) ;
          count++;
         i f ( c ount==1)
         {
            avi S tream = a vi Mana ger.AddVideoStrea m (f a lse, 25, bmp); 
      }
          av iS tream . AddFram e (b m p ) ;
          bmp .Dispose();        } 
      pu blicAv i Man ager avim
      {
         get
         {
          r etu rn avi M an age r ;
         } 
      set         {
              av i Man ager= val ue;          } 
      }
    }
}

Th en i n form iuse  i t l ik e thi s :
usin g S yst em;
usi ng Syst e m.C ol l e c ti ons.Generic;
using  S y s te m.Compon entMod e l; 
u s ing Syst em .Da ta;u s ing S yste m .D rawing;usingS ys te m.Linq; 
u sing S ys tem .Te xt;
u s ingSystem .Threadi ng.Ta s ks;
using Syst e m.Windows.For m s; u si n g Sy ste m.IO;

name spac e  Win dows F or msA p plica tion1 
{   public partial cla ss  Form1  : Fo rm
    {
       Screen s h o tsToAviscre e ns 2 avi;
        i nt co unt;
      Screen Captu re sc;
        p u b lic Form 1() 
     {            Ini t i aliz eC omponen t() ;

         s cre en s2avi = n ew Scree ns ho ts To Avi ();
        lab el 2.T ext = "0";
        co u nt= 0;
      s c= ne w S cr eenCa ptur e (); 

       }

     pri va te  void F orm1_Load(obj ec t sender,Ev ent Args e )        {

        }

        p r ivate v oid  time r1_T ick(objec t s ender,  Ev e ntArgs  e)
      { 
      c oun t+ +;
        sc.Ca pt ureS creen() ;
            scre e ns2 avi.CreateAvi (th is.s c ) ;      l abe l 2 .Text = count.T oString(); 
      }

    private  void b utton 1 _Click( object se nder, Eve nt Args e )
       {
          timer1 . Enabl e d= tru e;      }
       pri v ate  void  butto n2 _Click (obje ct  sender,  EventArgs e)
        { 
          t imer1.Ena ble d  =false;
          scre ens 2av i.avi m.C l ose() ;
    } 

     private v o id  bu t t on 3_Click(obj e c t  se nder,  Ev e ntArgs  e

 _ _   _ __ aviManager_=_new AviManager(@"d:\testdata\new.avi", false);
_  _   _}

  __    public void CreateAvi(ScreenCapture sc)
      __{
 ___    _   bmp =_new Bitmap(sc.CaptureScreen());
_       __  count++;
_        _  if (count == 1)
_  ___   _  {
   _     _      aviStream_= aviManager.AddVideoStream(false, 25, bmp);
  _    _ _  }
  _  _ _  _ aviStream.AddFrame(bmp);
    _  _    bmp.Dispose();
 __  ___}

 _  __ _public_AviManager avim
    __  {
    _   __  get
 _    _     {
_ _ _          _return aviManager;
    _   _ __}
  __ _      set
_ _     _   {
__     _     _  aviManager = value;
___    _    }
 _  _   }
   _}
}

Then_in form i use it like_this:
using_System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using_System.Text;
using_System.Threading.Tasks;
using_System.Windows.Forms;
using System.IO;

namespace WindowsFormsApplication1
{
  _ public partial class Form1 :_Form
    {
    _  _ScreenshotsToAvi screens2avi;
   ___  int count;
      _ ScreenCapture_sc;

  _     public Form1()
   _    {
  _         InitializeComponent();

 _       _  screens2avi = new ScreenshotsToAvi();
 _   __     label2.Text =_"0";
___  _  _  _count =_0;
  _ _  __   sc = new ScreenCapture();

        }

   _    private void_Form1_Load(object sender, EventArgs e)
 __  _  {

 _      }

 _      private void timer1_Tick(object_sender,_EventArgs e)
_   _ _ {
_  _ _ _ _  count++;
    __      sc.CaptureScreen();
  ____  _  _screens2avi.CreateAvi(this.sc);
  _  __     label2.Text_= count.ToString();

 _   _  }

       _private void button1_Click(object sender, EventArgs e)
        {
   _ _   _ _timer1.Enabled_= true;
    _ _ }

      __private void button2_Click(object sender, EventArgs e)
      __{
_  __     __timer1.Enabled_=_false;
_     _     screens2avi.avim.Close();
 __    _}

 __   _ private void button3_Click(object_sender, EventArgs e