#1 2015-11-06 01:11:58

kevinday
Member
Registered: 2015-10-28
Posts: 11

Suggested Chages to GDIPages

Hi Arnaud,

I suggest the following changes to Tgdipages to allow one to have lines around totals on columns such that there is a line close above the total and one close below the total.  I propose the following additions / changes for this:

Firstly in private section - overload LineInternal() as below

      procedure LineInternal(start, finish : integer; doubleline : boolean); overload;
      procedure LineInternal(aty, start, finish : integer; doubleline : boolean); overload;

New LineInternal() bodies

procedure TGDIPages.LineInternal(start, finish : integer; doubleline : boolean);
begin
  LineInternal(fCurrentYPos + (GetLineHeight shr 1), start, finish, doubleline);
end;

procedure TGDIPages.LineInternal(aty, start, finish : integer; doubleline : boolean);
var Y: integer;
begin
  if (Self <> nil) and (fCanvas <> nil) then
    with fCanvas do begin
      Pen.Width := MulDiv(fDefaultLineWidth, Self.Font.size, 8);
      if fsBold in Self.Font.style then Pen.Width := Pen.Width + 1;
      if doubleline then begin
        Y := aty - (Pen.Width);
        MoveTo(start, Y);
        LineTo(finish, Y);
        MoveTo(start, Y + (Pen.Width * 2));
        LineTo(finish, Y + (Pen.Width * 2));
      end else begin
        Y := aty - (Pen.Width shr 1);
        MoveTo(start, Y);
        LineTo(finish, Y);
      end;
    end;
end;

Then finally the new public method DrawColumnLine()

procedure TGDIPages.DrawColumnLine(ColIndex: integer; aAtTop: boolean;
  aDoDoubleLine: boolean);
var Y: integer;
begin
  if aAtTop then Y := fCurrentYPos - 1
  else Y := fCurrentYPos + fLineHeight + 1;
  with fColumns[ColIndex] do LineInternal(Y, ColLeft, ColRight, aDoDoubleLine);
end;

Offline

#2 2015-11-09 08:12:05

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,666
Website

Re: Suggested Chages to GDIPages

Should be included by http://synopse.info/fossil/info/3cf620def3

Thanks for sharing!

Offline

Board footer

Powered by FluxBB