Delphi and Kylix

Moderators: pritaeas
Number of threads: 7244
Number of posts: 19051

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Textout Posted by Iamkloot on 25 Nov 2002 at 10:06 AM

Hi Everone!

Does anyone know how to put text on a TImage using textout?Would be very greatfull of any help that you could give me!

Thanx!
Report
Re: Textout Posted by zibadian on 25 Nov 2002 at 11:57 AM
:
: Hi Everone!
:
: Does anyone know how to put text on a TImage using textout?Would be very greatfull of any help that you could give me!
:
: Thanx!
:
You could place a transparent TLabel over the image, but then the text isn't part of the image itself. Otherwise you also could use the API for it, but that is very error prone and quite difficult.
Report
Re: Textout Posted by Manning on 25 Nov 2002 at 3:02 PM
This message was edited by Manning at 2002-11-25 15:4:43

:
: Hi Everone!
:
: Does anyone know how to put text on a TImage using textout?Would be very greatfull of any help that you could give me!

This would write the words "This is a test" at pixel position 10,10 (relative to the top left corner) with white text on a black background:

Image1.Canvas.Font.Color := clWhite;
Image1.Canvas.Brush.Color := clBlack;
Image1.Canvas.TextOut(10, 10, 'This is a test');


Oh, one thing to note. Anything you write directly to the canvas in this way will be erased when the TImage repaints itself (ie: when you minimize and restore the application). So you'll have to remember anything you've written to the canvas, and override the OnPaint method to redraw everything the way you want it.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.