码迷,mamicode.com
首页 > Windows程序 > 详细

Delphi 画箭头

时间:2015-04-22 09:30:29      阅读:219      评论:0      收藏:0      [点我收藏+]

标签:

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;

 

Delphi 画箭头

标签:

原文地址:http://www.cnblogs.com/cb168/p/4446349.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!