In Depth Banner
Skip Navigation Links

Select your preferred language

Paint the form. 

    private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)

    {

      if(OuterPath==null)

        return;

      Pen p=new Pen(Color.DarkGray,4);

      p.Alignment=PenAlignment.Inset;

      e.Graphics.DrawPath(p,OuterPath);

 

      p.Color=Color.LightGray;

      p.Width=2;

 

      e.Graphics.SmoothingMode=SmoothingMode.AntiAlias;

      e.Graphics.DrawPath(p,OuterPath);

 

      if(closerPos!=0)

      {

        GraphicsPath gp=new GraphicsPath();

        gp.AddArc(this.Size.Width-90,0,90,90,270,90);

        gp.AddLine(this.Size.Width,45,this.Size.Width,0);

        gp.CloseFigure();

 

        e.Graphics.Clip=new Region(gp);

 

        e.Graphics.DrawImage(closeBitmap,new Rectangle(this.Size.Width-45,45-closerPos,closerPos,closerPos),0,0,closeBitmap.Width,closeBitmap.Height,GraphicsUnit.Pixel);

      }

 

      p.Dispose();

    }

 

Return to the article. 

Copyright © Bob Powell 2003-2009. All rights reserved