I'm working on a C# windows forms project using the glass aero effects available in Vista and Win 7, and getting the glow behind text effect using DrawThemeTextEx as per the code below. All works fine with normal aero glass, but if I add some colour to the glass (i.e. using LinearGradientBrush) the rectangle around the text is transparent does not include the colour painted with the brush.
I've done a bit of searching and reading, and it appears that CAPTUREBLT is designed to deal with this, but as mentioned in the Miscrosoft documentation it doesn't work properly with DC, which is what I'm using here.
My question therefore is is there another way of adding text using DrawThemeTextEx that will include painted layers?
public void DrawTextOnGlass(IntPtr hwnd, String text, Font font, Color forecolor, Rectangle bounds, int iglowSize, TextStyle textStyle)
{
if (VistaApi.IsCompositionEnabled())
{
RECT rc = new RECT();
RECT rc2 = new RECT();
//Just the same rect with rc,but (0,0) at the lefttop
rc2.left = 0;
rc2.top = 0;
rc2.right = rc.right - rc.left;
rc2.bottom = rc.bottom - rc.top;
IntPtr destdc = GetDC(hwnd); //hwnd must be the handle of form, not control
IntPtr Memdc = CreateCompatibleDC(destdc); // Set up a memory DC where we'll draw the text.
IntPtr bitmap;
IntPtr bitmapOld = IntPtr.Zero;
IntPtr logfnotOld;
int uFormat = DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_NOPREFIX; //text format
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.