2007. április 1., vasárnap

How to draw transparent text on a bitmap


Problem/Question/Abstract:

How to draw transparent text on a bitmap

Answer:

The following example demonstrates drawing transparent text on the canvas of a TBitmap:

procedure TForm1.Button1Click(Sender: TObject);
var
  OldBkMode: integer;
begin
  Image1.Picture.Bitmap.Canvas.Font.Color := clBlue;
  OldBkMode := SetBkMode(Image1.Picture.Bitmap.Canvas.Handle, TRANSPARENT);
  Image1.Picture.Bitmap.Canvas.TextOut(10, 10, 'Hello');
  SetBkMode(Image1.Picture.Bitmap.Canvas.Handle, OldBkMode);
end;

Nincsenek megjegyzések:

Megjegyzés küldése