c# - How to call DrawThemeTextEx in .NET -


I need to type a text with brightness in the Vista / seven glass windows, and I'm trying to call the API I have done a great check in CodeProject to write some text there, but the problem is that I am using .NET 1 (please, do not ask -)

I follwing to PInvoke. Need to translate NET 2 code, .NET 1 code? Can anyone help. System.Windows.Forms.VisualStyles VisualStyleRenderer Renderer = New VisualStyleRenderer (VisualStyleElement.Window.Caption.Active) using

  //; // Call to UxTheme.dll DrawThemeTextEx (renderer.Handle, Memory HDC, 0, 0, text, -1, (int) flags, referee text bounce, referee DTTOPS);   

The class VisualStyleRenderer is not present in Net 1, so I need to get the renderer.Handle in another way. Can anyone help beforehand?

Thank you.

After the

defined OpenThemeData API and DrawThemeTextEx, as well as some required structs and constants:

  [DllImport ("uxtheme.dll", charset = CharSet.Unicode)] Private Static Execution IntPtr OpenThemeData (IntPtr hwnd, string pszClassList); [DllImport ("uxtheme.dll", charset = CharSet.Unicode)] Private Execution Stable Int32 DrawThemeTextEx (IntPtr hTheme, IntPtr HDC, Integer iPartId, Integer iStateId, String pszText int iCharCount, uint flags, rect to RECT Rect, referee DTTOPTS poptions ); [Structure layout (LayoutCind.Security)] Personal structure RECT {Public left ANNA; Public at the top; Public int right; Down the public gap; } [Layout Layout (LayoutCind.Security)] Private Straight DTTPTS {Public Int Dishwas; DwFlags Public Inc.; Public int CRText; Public integer crossbord; Public Ent Cross Crow; Public Int iTextShadowType; Public Inc. ptShadowOffsetX; Public integer ptShadowOffsetY; Public IT iBorderSize; Public IT iFontPropId; Public int iColorPropId; Public IT iStateId; Public baul fApplyOverlay; Public IG IGlowSize; Public IntPtr pfnDrawTextCallback; Public Input Elparam; } // vsstyle.h Personal Compass int taken from WP_CAPTION = 1; Private contact int cs_activ = 1;   

And then, call it like this:

  IntPtr handle = OpenThemeData (IntPtr.Zero, "WINDOW"); DrawThemeTextExt (handle, hdc, WS_CAPTION, CS_ACTIVE, ...)   

WS_CAPTION and CS_ACTIVE match captions and active value respectively, match 2. Values ​​are officially described:

Comments