設置畫筆的 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;