Search results for 'SetBkMode'. 2 post(s) found.
- 2007/09/11 How to draw transparent text on Windows Desktop
- 2007/09/01 How to draw Transparent Text on bitmap
Here's how to draw transparent text on the Windows Desktop:
{
Usage:
DrawTextOnDesktop('About Delphi Programming'):
}
procedure DrawTextOnDesktop(TextToDraw: string) ;
var
Handle: HWND;
Dc: HDC;
ACanvas: TCanvas;
begin
Handle := GetDesktopWindow;
Dc := GetWindowDC(Handle) ;
ACanvas := TCanvas.Create;
try
ACanvas.Handle := DC;
BeginPath(ACanvas.Handle) ;
ACanvas.Font.Color := clRed;
ACanvas.Font.Name := 'Tahoma';
ACanvas.Font.Size := 30;
SetBkMode(ACanvas.Handle, TRANSPARENT) ;
EndPath(ACanvas.Handle) ;
ACanvas.TextOut(0, 0, TextToDraw) ;
finally
ReleaseDC(Handle, ACanvas.Handle) ;
ACanvas.Free;
end;
end;
Usage:
DrawTextOnDesktop('About Delphi Programming'):
}
procedure DrawTextOnDesktop(TextToDraw: string) ;
var
Handle: HWND;
Dc: HDC;
ACanvas: TCanvas;
begin
Handle := GetDesktopWindow;
Dc := GetWindowDC(Handle) ;
ACanvas := TCanvas.Create;
try
ACanvas.Handle := DC;
BeginPath(ACanvas.Handle) ;
ACanvas.Font.Color := clRed;
ACanvas.Font.Name := 'Tahoma';
ACanvas.Font.Size := 30;
SetBkMode(ACanvas.Handle, TRANSPARENT) ;
EndPath(ACanvas.Handle) ;
ACanvas.TextOut(0, 0, TextToDraw) ;
finally
ReleaseDC(Handle, ACanvas.Handle) ;
ACanvas.Free;
end;
end;
Another posts included in "Delphi"
| Extract an icon from an Windows application and paint on a Form (0) | 2007/09/11 |
| How to convert HIcon to TIcon ? (0) | 2007/09/11 |
| Get Cursor Image (draw it on a Canvas) (0) | 2007/09/11 |
| How to draw rotated text (0) | 2007/09/11 |
| How to convert an ICO to a BMP (0) | 2007/09/11 |
| How to Convert Pixels to Millimeters (0) | 2007/09/11 |
| How to capture Windows Desktop to Bitmap (0) | 2007/09/11 |
| Cut a rectangle from an Image to Clipboard (0) | 2007/09/11 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 00:11
moneyideas
-
Subject different money making ideas
2010/01/29 08:46
moneyideas
-
Subject different money making ideas
2010/01/31 16:39
moneyideas
You can set transparent mode by calling SetBkMode function.
procedure TForm1.Button1Click(Sender: TObject);
begin
with Image1.Picture.Bitmap.Canvas do
begin
Font.Color := clBlue;
Brush.Style := bsclear;
Font.Size := 13;
TextOut(10, 10, 'Transparent Text!!');
end;
end;
{**** Or / Oder ****}
procedure TForm1.Button1Click(Sender: TObject);
var
OldBkMode: integer;
begin
with Image1.Picture.Bitmap do
begin
Canvas.Font.Color := clBlue;
OldBkMode := SetBkMode(Canvas.Handle, Ord(TRANSPARENT));
Canvas.Font.Size := 13;
Canvas.TextOut(10, 10, 'Transparent Text!!');
SetBkMode(Canvas.Handle, OldBkMode);
end;
end;
begin
with Image1.Picture.Bitmap.Canvas do
begin
Font.Color := clBlue;
Brush.Style := bsclear;
Font.Size := 13;
TextOut(10, 10, 'Transparent Text!!');
end;
end;
{**** Or / Oder ****}
procedure TForm1.Button1Click(Sender: TObject);
var
OldBkMode: integer;
begin
with Image1.Picture.Bitmap do
begin
Canvas.Font.Color := clBlue;
OldBkMode := SetBkMode(Canvas.Handle, Ord(TRANSPARENT));
Canvas.Font.Size := 13;
Canvas.TextOut(10, 10, 'Transparent Text!!');
SetBkMode(Canvas.Handle, OldBkMode);
end;
end;
Another posts included in "Delphi"
| Browse for Computers, Folders, Files and Printers (0) | 2007/09/10 |
| Checking If File Is In Use (0) | 2007/09/10 |
| Convert a mapped drive to a full UNC path (0) | 2007/09/10 |
| How Do I Remove The Application Icon From The Taskbar? (0) | 2007/08/25 |
| How To Show The Print Dialog And Print Text Files (0) | 2007/08/25 |
| How To Make An Animated Application Icon (0) | 2007/08/25 |
| How To Pass The Focus To The Next/prior Control (0) | 2007/08/25 |
| How To Make Rounded Windows (0) | 2007/08/25 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 00:25
moneyideas
-
Subject different money making ideas
2010/01/29 08:40
moneyideas
-
Subject different money making ideas
2010/01/31 16:45
moneyideas

Prev

Rss Feed