procedure TjdSevenSegDisplay.DrawSegment(s: Byte);

var

W, H: Double;

P: Array[0..5] of TPoint;

begin

W := Width / 20;

H := Height / 38;

case s of

0://top

begin

P[0] := Point(round(w*2), round(h*1));

P[1] := Point(round(w*18), round(h*1));

P[2] := Point(round(w*(18-FSegWidth)), round(h*(1+FSegWidth)));

P[3] := Point(round(w*(2 +FSegWidth)), round(h*(1+FSegWidth)));

canvas.Polygon(P, 4);

end;

1://upper left

begin

P[0] := Point(round(w*1), round(h*2));

P[1] := Point(round(w*1), round(h*18));

P[2] := Point(round(w*(1+FSegWidth)), round(h*(18-FSegWidth)));

P[3] := Point(round(w*(1+FSegWidth)), round(h*(2+FSegWidth)));

Canvas.Polygon(P, 4);

end;

2://upper right

begin

P[0] := Point(round(w*19), round(h*2));

P[1] := Point(round(w*19), round(h*18));

P[2] := Point(round(w*(19-FSegWidth)), round(h*(18-FSegWidth)));

P[3] := Point(round(w*(19-FSegWidth)), round(h*(2+FSegWidth)));

Canvas.Polygon(P, 4);

end;

4://lower left

begin

P[0] := Point(round(w*1), round(h*20));

P[1] := Point(round(w*1), round(h*36));

P[2] := Point(round(w*(1+FSegWidth)), round(h*(36-FSegWidth)));

P[3] := Point(round(w*(1+FSegWidth)), round(h*(20+FSegWidth)));

Canvas.Polygon(P, 4);

end;

5://lower right

begin

P[0] := Point(round(w*19), round(h*20));

P[1] := Point(round(w*19), round(h*36));

P[2] := Point(round(w*(19-FSegWidth)), round(h*(36-FSegWidth)));

P[3] := Point(round(w*(19-FSegWidth)), round(h*(20+FSegWidth)));

canvas.Polygon(P, 4);

end;

6://bottom

begin

P[0] := Point(round(w*2), round(h*37));

P[1] := Point(round(w*18), round(h*37));

P[2] := Point(round(w*(18-FSegWidth)), round(h*(37-FSegWidth)));

P[3] := Point(round(w*(2+FSegWidth)), round(h*(37-FSegWidth)));

Canvas.Polygon(P, 4);

end;

3://middle

begin

P[0] := Point(round(w*2), round(h*19));

P[1] := Point(round(w*(2+FSegWidth/2)), round(h*(19-FSegWidth/2)));

P[2] := Point(round(w*(18-FSegWidth/2)), round(h*(19-FSegWidth/2)));

P[3] := Point(round(w*18), round(h*19));

P[4] := Point(round(w*(18-FSegWidth/2)), round(h*(19+FSegWidth/2)));

P[5] := Point(round(w*(2+FSegWidth/2)), round(h*(19+FSegWidth/2)));

Canvas.Polygon(P, 6);

end;

end;

end;