Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 05-17-2007, 12:31 AM
ZarrinPour ZarrinPour is offline
Senior Member
 
Join Date: Jul 2003
Posts: 232
Default How to Write Text on a Picture Permanently?

Hi all
How can I Write some text on a picture permametly for example i want to write Date And Time (as an axample) on the Desktop wallpaper each time Windows comes up.

Kind Regards.
Reply With Quote
  #2  
Old 05-17-2007, 02:44 AM
ciuly ciuly is offline
Senior Member
 
Join Date: Jul 2005
Location: Romania
Posts: 1,037
Send a message via Yahoo to ciuly
Default RE: How to Write Text on a Picture Permanently?

well, the easiest way is to:
- locate the picture on the hdd
- make a backup somewhere
- at windows startup, when your application starts:
-- copy the backup over the "original"
-- open it in a TImage for example, use the canvas textout to write whatever you want
-- save it
-- notify windows to change/reload the walpaper (SystemParametersInfo(SPI_SETDESKWALLPAPER,0,NULL, SPIF_SENDCHANGE); should do it, though I haven't tested it)
Reply With Quote
  #3  
Old 05-17-2007, 06:54 AM
johnjces johnjces is offline
Senior Member
 
Join Date: Oct 2001
Posts: 444
Default RE: How to Write Text on a Picture Permanently?

Maybe this will get you going a bit more quickly...

Code:
var
 tempbmp, bmp : TBitmap;
begin
 bmp := TBitmap.Create;
 bmp.Width := {width of text};      //210
 bmp.Height := {height of text};
 bmp.Canvas.FillRect(rect(0, 0, bmp.Width, bmp.Height));
 bmp.Canvas.Font.Color := ColorComboBox1.ColorValue;
 bmp.Canvas.Font.Name := FontComboBox1.FontName;
 bmp.Canvas.Font.Style := [fsBold];
 bmp.Canvas.Font.Size := SpinEdit1.Value;
 bmp.Canvas.TextOut(0, 0, 'This is my text');
 bmp.Transparent := True;
 tempbmp := TBitmap.Create;
 // This is your saved temporary bitmap which we mustload
 tempbmp.LoadFromFile(ExtractFileDir(ParamStr(0)) + '\~tmp.bmp'); 
 tempbmp.Canvas.Draw(Your X position), Round(Your Y position, bmp);
 Image1.Picture.Bitmap := tempbmp;
end;
Play around with it until you get the text where you want it. Then add code as ciuly suggests to make your new background appear.

John
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 09:41 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.