If you're talking about an OSD (On Screen Display) type window such as
that used by some volume controls then the _correct_ technique is to
implement a window using the LayeredWindow API via interop. The
advantage of this is that your LayeredWindow implementation can use a
per-pixel alpha scheme that makes the edges of text less harsh and
aliased. If this isn't a big issue however, you can also get away with
using a window whose region is defined by the glyphs of the type face.
Beware however when using this method because there seems to be a bug in
the GDI+ text system that causes the glyphs from a True Type typeface to
have a different size to the bitmap drawn from them. This is not the
usual grid-fitting problem but a more serious on where the height of
glyphs seems to be incorrectly reported to the GraphicsPath object. This
will result in wild mismatches between regions and brushes when using
certain fonts.
(Thinking on it it's probably a case of near-enough-is-good-enough on
the part of the font designer. TT is a broad church)
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
[quoted text, click to view] Paolo Niccolò Giubelli [Axettone] wrote:
> Hi guys! Is it possible to create a transparent layer where I can write some
> text? This layer should be visible even when I run an image viewer in
> fullscreen mode.