procedure TForm1.Line(x, y, x2, y2: integer);
begin
  canvas.MoveTo(x, y);
  canvas.LineTo(x2, y2);
end;

procedure TForm1.Button1Click(Sender: TObject);

var
  x, y, len: integer;
  r: TRect;

begin
  r := self.ClientRect;
  len := r.Right - r.Left;
  if len < 5 then
    len := 5;
  if len > 10 then
    len := 10;
  canvas.Pen.Color := canvas.Font.Color;
  canvas.Pen.Width := 1;
  canvas.Pen.Style := psSolid;
  x := (r.Right + r.Left + len) div 2;
  y := (r.Top + r.Bottom) div 2;

  //Left Arrow
  Line(x, y, x - len - 1, y);
  begin
    x := x - len + 1;
    Line(x, y - 1, x, y + 2);
    inc(x);
    Line(x, y - 2, x, y + 3);
    inc(x);
    Line(x, y - 2, x, y + 3);
  end;


  //Right Arrow
  x := x + 100;
  Line(x, y, x - len - 1, y);
  begin
    dec(x);
    Line(x, y - 1, x, y + 2);
    dec(x);
    Line(x, y - 2, x, y + 3);
    dec(x);
    Line(x, y - 2, x, y + 3);
  end;
end;

 

posted on 2015-04-22 08:37  lypzxy  阅读(655)  评论(0编辑  收藏  举报