What I draw a thick line in BMAX I get some half-hearted result at the ends of the lines.

This is caused by this code:
I change the code and I get semi-decent results, problem is that it don't work all the time.
Here is the new code:
And now some lines are correct and some are worse!

The two lines (on last pic) were drawn with :
Can someone please help, it's been a long day.

This is caused by this code:
Method DrawLine( x0#,y0#,x1#,y1#,tx#,ty# ) If islost Return Local lx0#,ly0#,lx1#,ly1# lx0=x0*ix+y0*iy+tx ly0=x0*jx+y0*jy+ty lx1=x1*ix+y1*iy+tx ly1=x1*jx+y1*jy+ty If linewidth=1.0 cverts[0]=lx0+.5001 cverts[1]=ly0+.5001 cverts[4]=lx1+.5001 cverts[5]=ly1+.5001 SetActiveFrame Null device.DrawPrimitive(D3DPT_LINESTRIP,D3DFVF_XYZ|D3DFVF_DIFFUSE,cverts,2,0) Else Local lw#=linewidth*0.5 If Abs(ly1-ly0)>Abs(lx1-lx0) cverts[0]=lx0-lw cverts[1]=ly0 cverts[4]=lx0+lw cverts[5]=ly0 cverts[8]=lx1-lw cverts[9]=ly1 cverts[12]=lx1+lw cverts[13]=ly1 Else cverts[0]=lx0 cverts[1]=ly0-lw cverts[4]=lx0 cverts[5]=ly0+lw cverts[8]=lx1 cverts[9]=ly1-lw cverts[12]=lx1 cverts[13]=ly1+lw EndIf SetActiveFrame Null device.DrawPrimitive(D3DPT_TRIANGLESTRIP,D3DFVF_XYZ|D3DFVF_DIFFUSE,cverts,4,0) EndIf End Method
I change the code and I get semi-decent results, problem is that it don't work all the time.
Here is the new code:
Method DrawLine( x0#,y0#,x1#,y1#,tx#,ty# ) If islost Return Local lx0#,ly0#,lx1#,ly1# lx0=x0*ix+y0*iy+tx ly0=x0*jx+y0*jy+ty lx1=x1*ix+y1*iy+tx ly1=x1*jx+y1*jy+ty If linewidth=1.0 cverts[0]=lx0+.5001 cverts[1]=ly0+.5001 cverts[4]=lx1+.5001 cverts[5]=ly1+.5001 SetActiveFrame Null device.DrawPrimitive(D3DPT_LINESTRIP,D3DFVF_XYZ|D3DFVF_DIFFUSE,cverts,2,0) Else Local lw#=linewidth*0.5 Local xd# = lx0 - lx1 Local yd# = ly0 - ly1 Local Mag:Double = Sqr(xd*xd + yd*yd) xd = xd / mag * lw yd = yd / mag * lw If Abs(ly1-ly0)>Abs(lx1-lx0) cverts[0]=lx0-xd cverts[1]=ly0+yd cverts[4]=lx0+xd cverts[5]=ly0-yd cverts[8]=lx1-xd cverts[9]=ly1+yd cverts[12]=lx1+xd cverts[13]=ly1-yd Else cverts[0]=lx0+xd cverts[1]=ly0-yd cverts[4]=lx0-xd cverts[5]=ly0+yd cverts[8]=lx1+xd cverts[9]=ly1-yd cverts[12]=lx1-xd cverts[13]=ly1+yd EndIf SetActiveFrame Null device.DrawPrimitive(D3DPT_TRIANGLESTRIP,D3DFVF_XYZ|D3DFVF_DIFFUSE,cverts,4,0) EndIf End Method
And now some lines are correct and some are worse!

The two lines (on last pic) were drawn with :
SetLineWidth(24) DrawLine 400,50,240,200 ' GOOD LINE DrawLine 10,180,400,050 ' WORSE LINE
Can someone please help, it's been a long day.