WinAPI: SetTextJustification - 设置两端对齐

//声明:
SetTextJustification(
  DC: HDC;            {设备环境句柄}
  BreakExtra,         {宽度}
  BreakCount: Integer {被分成几份; 一般以空格为间隔}
): Integer;           {成功返回非 0 值; 失败返回 0}

 
 
 
 
 

 

 
  

//举例:
procedure TForm1.FormPaint(Sender: TObject);
const
  str = 'CodeGear Delphi 2007';
begin
  TextOut(Canvas.Handle, 1, 50, str, Length(str));

  SetTextJustification(Canvas.Handle, ClientWidth, 3);
  TextOut(Canvas.Handle, 1, 80, str, Length(str));
end;

 
 
 
 
 

 

 
  

//效果图:
WinAPI: SetTextJustification - 设置两端对齐

你可能感兴趣的:(WinAPI: SetTextJustification - 设置两端对齐)