Board index » delphi » font background color

font background color

Is there a property that can be set to have the background of text be
transparent either at font design time or in the application?  I have
been able to write the characters under a graphical lines by drawing
them after the text is placed, however there are cases where text needs
to be placed partially over other text so that all of it can be seen.
As I see it I need a font with a transparent background.  Is there such
a thing?
 

Re:font background color


If you are drawing the text on a canvas then the canvas brush controls the
background color. Set brush.style to bsClear to draw text with a transparent
background.

James R. Darrah <jrdar...@us.ibm.com> wrote in message
news:37A7B11E.67B332B8@us.ibm.com...

Quote
> Is there a property that can be set to have the background of text be
> transparent either at font design time or in the application?  I have
> been able to write the characters under a graphical lines by drawing
> them after the text is placed, however there are cases where text needs
> to be placed partially over other text so that all of it can be seen.
> As I see it I need a font with a transparent background.  Is there such
> a thing?

Re:font background color


In article <37A7B11E.67B33...@us.ibm.com>, "James R. Darrah"

Quote
<jrdar...@us.ibm.com> writes:
>Is there a property that can be set to have the background of text be
>transparent either at font design time or in the application?  I have
>been able to write the characters under a graphical lines by drawing
>them after the text is placed, however there are cases where text needs
>to be placed partially over other text so that all of it can be seen.
>As I see it I need a font with a transparent background.  Is there such
>a thing?

Check out:

 SetBkMode, SetBkColor, SetTextAlign in Win32 help 'Font and Text functions'.

 Note: the return value of these functions is the prvious setting, it can be
useful.

Gordon.
~~~~~~~~~~~~~~~~~~~~~~~~
Certifiable - definitely <g>

http://members.aol.com/mgcsoft/  (the function junction equation editor)
http://members.aol.com/delphistuf/delphstf.htm   (Delphi bits and bobs and a
few links)

MGCSoft

Re:font background color


Hi !

Use the WinAPI function

  SetBKMode(SomeControl.Canvas.handle, TRANSPARENT);

The transparent/opaque drawing mode is a facility of the device context (DC), not the font. What is
done in OPAQUE mode (that's the default setting), is that the rectangle is filled with the current
brush, then the text is drawn on top. When transparent, it only draws the text.

--

Bjoerge

<<UUCP skrev i meldingen ...
From: "James R. Darrah" <jrdar...@us.ibm.com>
Subject: font background color
Organization: ibm.com

Is there a property that can be set to have the background of text be
transparent either at font design time or in the application?  I have
been able to write the characters under a graphical lines by drawing
them after the text is placed, however there are cases where text needs
to be placed partially over other text so that all of it can be seen.
As I see it I need a font with a transparent background.  Is there such
a thing?

Quote

Re:font background color


Canvas.Brush.Style := bsClear;

Joe
--
Joe C. Hecht
http://home1.gte.net/joehecht/index.htm

Re:font background color


<<Joe C. Hecht skrev i meldingen <37A8C7E3....@gte.net>...
Canvas.Brush.Style := bsClear;>>

... but then you'l have to alter it back and forth every time you need a colored brush.
SetBKMode(Canvas.Handle, TRANSPARENT) doesn't affect a normal, solid brush.
--

Bjoerge

Other Threads