Board index » cppbuilder » TextOut in inveser color?

TextOut in inveser color?


2007-07-27 05:49:09 PM
cppbuilder18
The TPen->Mode property does not
seem to have any effect on TextOut() function.
Is it possible to write text with
pmNot (inverse of canvas color) option?
(TFont does not have mode member.)
 
 

Re:TextOut in inveser color?

On 27 Lug, 11:49, "Harish" < XXXX@XXXXX.COM >wrote:
Quote
The TPen->Mode property does not
seem to have any effect on TextOut() function.
Is it possible to write text with
pmNot (inverse of canvas color) option?
(TFont does not have mode member.)
Try this way:
String s = "ciao";
BeginPath(PaintBox1->Canvas->Handle);
PaintBox1->Canvas->TextOut(P.x,P.y,s);
EndPath(PaintBox1->Canvas->Handle);
PaintBox1->Canvas->Pen->Mode = pmNot ;
//::StrokeAndFillPath(PaintBox1->Canvas->Handle);
::FillPath(PaintBox1->Canvas->Handle);
 

Re:TextOut in inveser color?

Harish wrote:
Quote
The TPen->Mode property does not
seem to have any effect on TextOut() function.
Is it possible to write text with
pmNot (inverse of canvas color) option?
(TFont does not have mode member.)

Well a way around this is to use TextExtent with your Canvas.
This will give you the height and width of the text you want to paste.
Then you create a TRect and use FillRect (which uses the BRUSH not the
pen). Then set the font color to whatever 'inverse' color you want. I
know there are other ways of doing it. However it's been numerous years
since I've played with TCanvas proprerties etc.
Stephen
 

{smallsort}

Re:TextOut in inveser color?

Hi Harish,
You can do this by using an intermediate bitmap. Have a look at the
following post...
tinyurl.com/2ebq3e
Cheers,
Harish wrote:
Quote
The TPen->Mode property does not
seem to have any effect on TextOut() function.
Is it possible to write text with
pmNot (inverse of canvas color) option?
(TFont does not have mode member.)