.
In Depth Banner
Skip Navigation Links

Select your preferred language

The Checker board case handler.

        case TransitionTypes.Checker:

          pth=new GraphicsPath();

          int cw=(int)(this.Width*_currentPercentage/100)/_nHDivs;

          int ch=this.Height/_nVDivs;

          int row=0;

          for(int y=0; y<this.Height; y+=ch)

          {

            for(int x=0; x<this.Width; x+=this.Width/_nHDivs)

            {

              Rectangle rc=new Rectangle(x,y,cw,ch);

              if((row&1)==1)

                rc.Offset(this.Width/(2*_nVDivs),0);

              pth.AddRectangle(rc);

              if(_currentPercentage>=50 && (row&1)==1 && x==0)

              {

                rc.Offset(-(this.Width/_nHDivs),0);

                pth.AddRectangle(rc);

              }

            }

            row++;

          }

          Region r=new Region(pth);

          e.Graphics.SetClip(r,CombineMode.Replace);

          e.Graphics.DrawImage(_imageB,ClientRectangle,0,0,_imageB.Width,_imageB.Height,GraphicsUnit.Pixel);

          r.Dispose();

          pth.Dispose();

          break;

 

Return to the article. 

Copyright © Bob Powell 2000-.  All rights reserved.