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


设置画笔的 CompoundArray 属性可得到复合画笔.

它对应的类型是 IGPCompoundArray (IGPCompoundArray = IGPArray<Single>).

如果复合画笔是 X 条线, 则数组需要 2*X 个元素; 元素从外向里分别表示线的起点和终点的比例值.



uses GdiPlus;

procedure TForm1.FormPaint(Sender: TObject);
var
  Graphics: IGPGraphics;
  Pen: IGPPen;
  Rect: TGPRect;
  CompoundArr: IGPCompoundArray;
begin
  Graphics := TGPGraphics.Create(Handle);
  Rect.Initialize(20, 20, 200, 100);
  Pen := TGPPen.Create($FFFF0000, 10);

  CompoundArr := TGPArray<Single>.Create(4);
  CompoundArr[0] := 0;
  CompoundArr[1] := 0.5;
  CompoundArr[2] := 0.9;
  CompoundArr[3] := 1;

  Pen.CompoundArray := CompoundArr;
  Graphics.DrawEllipse(Pen, Rect);
end;

posted on 2009-12-16 00:22 万一 阅读(...) 评论(...) 编辑 收藏