GapX

edited May 2017 in FastReport VCL 5
it seems gapx creates an indent from left AND right side independent from text-alignment!
In my opinion the indent has only to be respected at the aligned side. Are there plans to modify this and how are the experiences of the other users?

Comments

  • gpigpi
    edited 7:09AM
    wrote:
    it seems gapx creates an indent from left AND right side independent from text-alignment!
    Yes, this is expected behavior
  • edited 7:09AM
    but this doesn't make sense (for me). I need an alternative behavior. Where can I modify thisin the sources?
  • gpigpi
    edited 7:09AM
    wrote:
    Where can I modify thisin the sources?
    Search for GapX in the frxClass.pas
  • edited 7:09AM
    solved:
    procedure TfrxCustomMemoView.BeginDraw(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended);
    var
      bx, by, bx1, by1, wx1, wx2, wy1, wy2, gx1, gy1: Integer;
    begin
      inherited BeginDraw(Canvas, ScaleX, ScaleY, OffsetX, OffsetY);
      wx1 := Round((Frame.Width * ScaleX - 1) / 2);
      wx2 := Round(Frame.Width * ScaleX / 2);
      wy1 := Round((Frame.Width * ScaleY - 1) / 2);
      wy2 := Round(Frame.Width * ScaleY / 2);
      bx := FX;
      by := FY;
      bx1 := FX1;
      by1 := FY1;
      if ftLeft in Frame.Typ then
        Inc(bx, wx1);
      if ftRight in Frame.Typ then
        Dec(bx1, wx2);
      if ftTop in Frame.Typ then
        Inc(by, wy1);
      if ftBottom in Frame.Typ then
        Dec(by1, wy2);
      gx1 := Round(GapX * ScaleX);
      gy1 := Round(GapY * ScaleY);
     // GapX-Position in relation to current HAlign 
      case HAlign of
        haCenter,
        haBlock  : FTextRect := Rect(bx + gx1, by + gy1, bx1 - gx1 + 1, by1 - gy1 + 1);
        haLeft   : FTextRect := Rect(bx + gx1, by + gy1, bx1 + 1, by1 - gy1 + 1);
        haRight  : FTextRect := Rect(bx, by + gy1, bx1 - gx1 + 1, by1 - gy1 + 1);
      end;
    end;
    

Leave a Comment