Canvas - texto com fundo transparente |
Top Previous Next |
|
Fundo do texto transparente
procedure TForm1.Button1Click(Sender: TObject); var OldBkMode : integer; begin with Form1.Canvas do begin Brush.Color := clRed; FillRect(Rect(0, 0, 100, 100)); Brush.Color := clBlue; TextOut(10, 20, 'Não é Transparente!'); OldBkMode := SetBkMode(Handle, TRANSPARENT); TextOut(10, 50, 'É Transparente!'); SetBkMode(Handle, OldBkMode); end; end;
------------------ EM ANGULO E 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); TextOut(X, Y, Texto); SetBkMode(Handle, OldBkMode); end; end; |