GetTextAlign not found

Issue #148 resolved
Paul TOTH created an issue

and BTW TA_UPDATECP is not supported

SetTextAlign(FDC, Align or TA_UPDATECP);

Comments (6)

  1. Eugene Kryukov repo owner

    How you use this function ? The point that we don't have plan to support whole API set.

  2. Paul TOTH reporter

    I know

    this is the code I use

    procedure TForm1.FormPaint(Sender: TObject);
    var
      p: PChar;
      dc: HDC;
      x: Integer;
      s: TSize;
    begin
      p := 'Hello World !';
      dc := Canvas.Handle;
    
      x := 10;
    
      SetBkColor(dc, $FFFFFF); // not supported
      SetTextColor(dc, 0);
      TextOut(dc, x, 10, p, 3);
      GetTextExtentPoint32(dc, p, 3, s); // the length parameter seems to be ignored
      Inc(x, s.cx);
    
      SetBkColor(dc, $FF9933);
      SetTextColor(dc, $FFFFFF);
      TextOut(dc, x, 10, @p[3], 5); 
      GetTextExtentPoint32(dc, @p[3], 5, s);
      Inc(x, s.cx);
    
      SetBkColor(dc, $FFFFFF);
      SetTextColor(dc, 0);
      TextOut(dc, x, 10, @p[8], 5);
    
      SetTextAlign(DC, TA_UPDATECP); // no need to care about the text size (GetTextExtentExPoint was used to know the number of characters to draw)
      MoveToEx(DC, 10, 30, nil); // just set the origin
      SetBkColor(dc, $FFFFFF);
      SetTextColor(dc, 0);
      TextOut(dc, 0, 0, p, 3); // draw from origin and move the current position (x and y should be ignored)
    
      SetBkColor(dc, $FF9933);
      SetTextColor(dc, $FFFFFF);
      TextOut(dc, 0, 0, @p[3], 5);
    
      SetBkColor(dc, $FFFFFF);
      SetTextColor(dc, 0);
      TextOut(dc, 0, 0, @p[8], 5);
    
    end;
    
  3. Log in to comment