+ -
当前位置:首页 → 问答吧 → 这种框框如何画出来?

这种框框如何画出来?

时间:2011-09-14

来源:互联网


画一个封闭的框很容易,如何画成如图所示的漂亮框框? 

作者: wealsh   发布时间: 2011-09-14

可以试试下面这个函数
PolyPolygon(
  DC: HDC; {设备环境句柄}
  var Points; {点数组}
  var nPoints;{数组, 数组元素是每个多边形的顶点数}
  p4: Integer {多边形数, 也就是 nPoints 的元素数}
): BOOL;
绘制一组多边形

作者: m617105   发布时间: 2011-09-14

canvas上画,一条线一条线的画也可以

作者: bdmh   发布时间: 2011-09-14

学习学习。

作者: delphi_freeman   发布时间: 2011-09-14

moveto lineto 就可以了吧

作者: mdejtod   发布时间: 2011-09-14

left 
 top
 right
 bottom

 Canvas.Rectangle(left, top, right, bottom);

矩形框是用这个代码画出来的,如何用 moveto lineto 画出我要的效果?

作者: wealsh   发布时间: 2011-09-14

如果你只要实现这种图形,简单啊
Canvas.Rectangle(10,10,110,110);
Canvas.FillRect(Rect(30,10, 90, 110));
Canvas.FillRect(Rect(10,30, 110, 90));

作者: flcop   发布时间: 2011-09-14

画八条线。

作者: ZyxIp   发布时间: 2011-09-14

procedure DrawYours(c: TCanvas; r: TRect);
const size = 5;
var
  x, y: integer;
begin
  x := (r.Right - r.Left) div size;
  y := (r.Bottom - r.Top) div size;
  c.Pen.Style := psSolid;

  with c, r do
  begin
  MoveTo(left, top);
  LineTo(left, top + y);
  MoveTo(left, bottom);
  LineTo(left, Bottom - y);

  MoveTo(left, top);
  LineTo(left + x, Top);
  MoveTo(right, top);
  LineTo(Right - x, top);

  MoveTo(right, top);
  LineTo(Right, top + y);
  MoveTo(right, Bottom);
  LineTo(Right, Bottom - y);

  MoveTo(Left, Bottom);
  LineTo(Left + x, bottom);
  moveto(Right, Bottom);
  LineTo(right - x, bottom);
  end;
end;

demo:

 drawYours( formX.canvas, rect(20,20,200,200));


已搞定

作者: wealsh   发布时间: 2011-09-14

路过

作者: SmallHand   发布时间: 2011-09-14

有谁能把上面的代码 转成 VC++ ?谢谢

作者: wealsh   发布时间: 2011-09-30

直接添加pas来调用

作者: jingtuzhong   发布时间: 2011-09-30