Problem with Windows aero text editor

I am using a window form with GlassForm (using Microsoft.WindowsAPICodePack.Shell;). my problem is when I change form to GlassForm my text message texts are not

0
c # winapi winforms aero-glass
source share
3 answers

Yes, how does it work. With the Aero Glass effect applied, everything painted in black will be displayed as transparent. This includes the text in the text box control. This common theme has been the subject of many other issues here. When they are well written, they collect a lot of votes, but few answers.

There are not many good solutions here. All of them that I encountered qualify as ugly and hacker. Own drawing is a reasonable approach when you use something like a shortcut control, but I would not recommend drawing your own text box - it is too difficult to get the right one. Someone tried to do it here ; as I said, the result is both ugly and hacky. I was not happy with this for my own use, but it may work for you, depending on how high your standards are.

The goal with owner drawing, of course, is to make the whole drawing using GDI + (which initially supports transparency) instead of GDI (which all built-in controls use by default) or calling functions like DrawThemeTextEx , which is specifically designed for rendering text with a shadow that is [somewhat] read over glass.

In addition, regular tricks, such as enabling compatible text rendering (which forces the built-in controls to draw using GDI + routines, as was the case in earlier versions of .NET), do not work for the text field.

Honestly, it’s best to place a text box over the region of your form that doesn't display like glass. Use the DwmEnableBlurBehindWindow function to selectively activate the glass effect over specific areas of your shape, and not the whole thing. I provide a complete, ready-to-use .NET implementation in my answer here .

+3
source share

Place the panel in the form to fill the dock style, set the BackColor panel to color X, and then set the TransparencyKey to the same color X.

+3
source share

Check out this sample: http://www.danielmoth.com/Blog/Glass-In-C-An-Alternative-Approach.aspx

I did not study it further, but working with TextBox or Button or other components on this area of ​​Aero Glass worked - the processed component did not have a problem with transparency. Labels are not perfect, but they can be easily drawn using GDI + A direct link to a sample project is here: http://www.danielmoth.com/Blog/MothGlass.zip

It looks like he puts the panel behind the control panel and sets the TransparencyKey for the panel.

enter image description here

+1
source share

All Articles