Canvas - desenhando texto em angulo |
Top Previous Next |
|
// DETALHE: Com fundo transparente
// Angulo: 90, 45, 180 ou -90, -45, -180... procedure EscreveDiagonal(const Texto: string; const X, Y: Integer; Angulo: Integer; Superficie: TCanvas; Fonte: string = 'Tahoma'; Tamanho: Integer = 10); var lf : TLogFont; tf : TFont; OldBkMode : integer; begin with Superficie do begin Font.Name := Fonte; Font.Size := Tamanho; tf := TFont.Create; tf.Assign(Font); GetObject(tf.Handle, sizeof(lf), @lf); lf.lfEscapement := Angulo * 10; lf.lfOrientation := Angulo * 10; tf.Handle := CreateFontIndirect(lf); Font.Assign(tf); tf.Free; OldBkMode := SetBkMode(Handle, TRANSPARENT); <--- Se nao quer transparente tire esta linha TextOut(X, Y, Texto); SetBkMode(Handle, OldBkMode); <--- Se nao quer transparente tire esta linha end; end; |