随笔 - 2146  文章 - 97 评论 - 11758 trackbacks - 253

//画笔
var
  g: TGPGraphics;
  p: TGPPen;
begin
  g := TGPGraphics.Create(Canvas.Handle);

  p := TGPPen.Create(aclRed, 2);
  {参数1颜色; 参数2是笔宽, 笔宽是可选, 默认 1}

  g.DrawEllipse(p, 11, 11, 222, 111);

  p.Free;
  g.Free;
end;

//设置笔宽与颜色 var g: TGPGraphics; p: TGPPen; begin g := TGPGraphics.Create(Canvas.Handle); p := TGPPen.Create(aclBlack); {建立时应该不给参数是可以的, 但在测试中不行, 至少要给一个颜色} p.SetColor(aclBlue); {设置颜色} p.SetWidth(10); {设置笔宽} g.DrawEllipse(p, 11, 11, 222, 111); p.Free; g.Free; end;
//获取笔宽与颜色 var g: TGPGraphics; p: TGPPen; c: TGPColor; begin g := TGPGraphics.Create(Canvas.Handle); p := TGPPen.Create(MakeColor(128,0,0,255), 10); g.DrawEllipse(p, 11, 11, 222, 111); p.GetColor(c); {获取颜色给 c} ShowMessage(IntToHex(c, 8)); {转换为十六进制: 800000FF} ShowMessage(FloatToStr(p.GetWidth)); {10} p.Free; g.Free; end;
posted on 2007-12-27 13:28 万一 阅读(...) 评论(...) 编辑 收藏