Clear[f,a,b,n,deltax,x,xPts]
f[x_]:= 2x^2+2;
a=-4.0;
b=4.0;

Left endpoint

Manipulate[deltax=(b-a)/n;
Show[{Plot[f[x],{x,a,b},
PlotRange->{{a-1,b+1},{0,Automatic}},PlotStyle->{Thick,Blue}],

Table[Graphics[{Thick,Dashed,Red,Line[{{a+i deltax,0},{a+i deltax,f[a+i deltax]},{a+(i+1) deltax,f[a+i deltax]},{a+(i+1) deltax,f[a+(i+1) deltax]}}]}],{i,0,n-1}],

Graphics[{Thick,Dashed,Red,Line[{{a+n deltax,0},{a+n deltax,f[a+n deltax]} }] }]
  }]   ,{n,3,30}]

Right endpoint

Manipulate[deltax=(b-a)/n;
Show[{Plot[f[x],{x,a,b},
PlotRange->{{a-1,b+1},{0,Automatic}},PlotStyle->{Thick,Blue}],

Table[Graphics[{Thick,Dashed,Red,Line[{{a+i deltax,0},{a+i deltax,f[a+(i+1) deltax]},{a+(i+1) deltax,f[a+(i+1) deltax]},{a+(i+1) deltax,f[a+(i+2) deltax]}}]}],{i,0,n-1}],

Graphics[{Thick,Dashed,Red,Line[{{a+n deltax,0},{a+n deltax,f[a+n deltax]} }] }]
  }]  ,{n,3,30}]

Midpoint

Manipulate[deltax=(b-a)/n;
Show[{Plot[f[x],{x,a,b},
PlotRange->{{a-1,b+1},{0,Automatic}},PlotStyle->{Thick,Blue}],

Table[Graphics[{Thick,Dashed,Red,Line[{
{a+i deltax ,0},
{a+i deltax,f[a+(i+.5) deltax]},{a+(i+1) deltax,f[a+(i+.5) deltax]},{a+(i+1) deltax,f[a+(i+1.5) deltax]}}]}],{i,0,n-1}],

Graphics[{Thick,Dashed,Red,Line[{
{a+n  deltax,0},
{a+n* deltax,f[a+(n+.5)* deltax]} }] }]
  }]  ,{n,3,30}]