Question and Answer Database FAQ627D.txt Making text background transparent Category :Windows API Platform :All Product :All 32 bit Question: How do I make the text background transparent? Answer: Use the Windows API function SetBkMode(). Example: 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, 'Not Transparent!'); OldBkMode := SetBkMode(Handle, TRANSPARENT); TextOut(10, 50, 'Transparent!'); SetBkMode(Handle, OldBkMode); end; end; 7/16/98 4:31:28 PM
Last Modified: 01-SEP-99